How to use json_dumps method in avocado

Best Python code snippet using avocado_python

views.py

Source:views.py Github

copy

Full Screen

...22 'Authorization': 'Bearer ' + self.eslCloudClient.token23 }24 url = self.eslCloudClient.useSceneUrl25 result = yield asyncTornadoRequest(url,method='GET',headers=self.headers)26 self.write(json_dumps(result))27class GoodsView(web.RequestHandler):28 def initialize(self, server):29 self.eslCloudClient = server.eslCloudClient30 self.ioloop = server.ioloop31 self.storeCode = server.eslCloudClient.storeCode32 #todo:根据标签查询绑定商品 ==>测试ok33 @gen.coroutine34 def get(self,*args,**kwargs):35 #todo:公共数据36 self.headers = {37 'content-type': 'application/json',38 'Authorization': 'Bearer ' + self.eslCloudClient.token39 }40 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')41 transactionPoint = transaction_info.get('point')42 #todo: 获取参数43 mac = self.get_argument('mac', '') # 条形码44 if not all([mac]):45 content = {46 'ret':RET.PARAMERR,47 'msg':'标签未知'48 }49 return self.write(json_dumps(content))50 data = {51 'mac':mac,52 }53 url = self.eslCloudClient.queryGoodsUrl54 result = yield asyncTornadoRequest(url, method='GET', headers=self.headers, params=data)55 status = result.get('status')56 if status == 200:57 content = {58 'goods':result,59 'ret': RET.OK,60 'msg': '商品添加成功'61 }62 elif status == 210:63 content = {64 'ret': RET.PARAMERR,65 'msg': '标签没有绑定商品'66 }67 else:68 content = {69 'ret': RET.PARAMERR,70 'msg': '未知错误'71 }72 self.write(json_dumps(content))73 #todo:新增商品信息 ==>测试ok74 @gen.coroutine75 def post(self,*args,**kwargs):76 self.headers = {77 'content-type': 'application/json',78 'Authorization': 'Bearer ' + self.eslCloudClient.token79 }80 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')81 transactionPoint = transaction_info.get('point')82 #todo:获取参数83 barcode = self.get_argument('barcode','') #条形码84 qrcode = self.get_argument('qrcode','') #二维码85 label1 = barcode86 label2 = qrcode87 label3 = self.get_argument('label3', '')88 label4 = self.get_argument('label4', '')89 label5 = self.get_argument('label5', '')90 label6 = self.get_argument('label6', '')91 label7 = self.get_argument('label7', '')92 label8 = self.get_argument('label8', '')93 label9 = self.get_argument('label9', '')94 label10 = self.get_argument('label10', '')95 label11 = self.get_argument('label11', '')96 label12 = self.get_argument('label12', '')97 label13 = self.get_argument('label13', '')98 label14 = self.get_argument('label14', '')99 label15 = self.get_argument('label15', '')100 label16 = self.get_argument('label16', '')101 label17 = self.get_argument('label17', '')102 label18 = self.get_argument('label18', '')103 photo1 = self.get_argument('photo1', '')104 photo2 = self.get_argument('photo2', '')105 photo3 = self.get_argument('photo3', '')106 photo4 = self.get_argument('photo4', '')107 photo5 = self.get_argument('photo5', '')108 if not all([barcode]):109 content = {110 'ret':RET.PARAMERR,111 'msg':'条形码参数未知'112 }113 return self.write(json_dumps(content))114 #todo:判断数据库中是否有barcode的记录,is_delete=Ture115 data = {116 'fields': ['barcode'],117 'eq': {118 'barcode': barcode119 },120 }121 data['database'] = 'aura'122 msg = yield mysql_client.tornadoSelectOnly('d_shop_goods', data)123 if not isinstance(msg, dict):124 content = {125 'ret': RET.PARAMERR,126 'msg': msg127 }128 return self.write(json_dumps(content))129 if msg['ret'] != '0':130 content = {131 'ret': RET.PARAMERR,132 'msg': '数据库查询错误'133 }134 return self.write(json_dumps(content))135 else:136 # todo:若不存在,新增商品信息137 if msg['lenght'] == 0:138 # todo:保存至数据库139 data = {140 'transactionPoint': transactionPoint,141 'msg': {142 "barcode": barcode,143 'create_time': datetime.datetime.now(),144 'update_time': datetime.datetime.now(),145 'is_delete': False,146 "qrcode": qrcode,147 "label1": label1,148 "label2": label2,149 "label3": label3,150 "label4": label4,151 "label5": label5,152 "label6": label6,153 "label7": label7,154 "label8": label8,155 "label9": label9,156 "label10": label10,157 "label11": label11,158 "label12": label12,159 "label13": label13,160 "label14": label14,161 "label15": label15,162 "label16": label16,163 "label17": label17,164 "label18": label18,165 "photo1": photo1,166 "photo2": photo2,167 "photo3": photo3,168 "photo4": photo4,169 "photo5": photo5,170 },171 }172 data['database'] = 'aura'173 msg = yield mysql_client.tornadoInsertOne('d_shop_goods', data)174 if not isinstance(msg, dict):175 content = {176 'ret': RET.DBERR,177 'msg': msg178 }179 return self.write(json_dumps(content))180 if msg['ret'] != '0':181 content = {182 'ret': RET.DBERR,183 'msg': '数据库插入错误'184 }185 return self.write(json_dumps(content))186 # todo:若存在,修改商品信息187 else:188 data = {189 'transactionPoint': transactionPoint,190 'msg': {191 'update_time': datetime.datetime.now(),192 'is_delete': False,193 "qrcode": qrcode,194 "label1": label1,195 "label2": label2,196 "label3": label3,197 "label4": label4,198 "label5": label5,199 "label6": label6,200 "label7": label7,201 "label8": label8,202 "label9": label9,203 "label10": label10,204 "label11": label11,205 "label12": label12,206 "label13": label13,207 "label14": label14,208 "label15": label15,209 "label16": label16,210 "label17": label17,211 "label18": label18,212 "photo1": photo1,213 "photo2": photo2,214 "photo3": photo3,215 "photo4": photo4,216 "photo5": photo5,217 },218 'eq': {219 "barcode": barcode,220 }221 }222 data['database'] = 'aura'223 msg = yield mysql_client.tornadoUpdateMany('d_shop_goods', data)224 if not isinstance(msg, dict):225 content = {226 'ret': RET.DBERR,227 'msg': msg228 }229 return self.write(json_dumps(content))230 if msg['ret'] != '0':231 content = {232 'ret': RET.DBERR,233 'msg': '数据库修改错误'234 }235 return self.write(json_dumps(content))236 #todo:同步至WSL云237 shopGoods = {238 "goods": [239 {240 "barcode": barcode,241 "qrcode": qrcode,242 "label1": label1,243 "label2": label2,244 "label3": label3,245 "label4": label4,246 "label5": label5,247 "label6": label6,248 "label7": label7,249 "label8": label8,250 "label9": label9,251 "label10": label10,252 "label11": label11,253 "label12": label12,254 "label13": label13,255 "label14": label14,256 "label15": label15,257 "label16": label16,258 "label17": label17,259 "label18": label18,260 "photo1": photo1,261 "photo2": photo2,262 "photo3": photo3,263 "photo4": photo4,264 "photo5": photo5,265 },266 ],267 "storeUuid": self.storeCode #必填参数 门店编码268 }269 url = self.eslCloudClient.goodsUrl270 result = yield asyncTornadoRequest(url,method='POST',headers=self.headers,body=shopGoods)271 status = result.get('status')272 if status == 200:273 #todo:数据提交274 yield mysql_client.asyncioCommitTransaction(transactionPoint)275 content = {276 'ret':RET.OK,277 'msg':'商品添加成功'278 }279 elif status == 400:280 #todo:回滚281 yield mysql_client.asyncioRollbackTransaction(transactionPoint)282 content = {283 'ret': RET.PARAMERR,284 'msg': '没有此门店编码'285 }286 elif status == 401:287 # todo:回滚288 yield mysql_client.asyncioRollbackTransaction(transactionPoint)289 content = {290 'ret': RET.PARAMERR,291 'msg': '门店编码为空'292 }293 elif status == 404:294 # todo:回滚295 yield mysql_client.asyncioRollbackTransaction(transactionPoint)296 content = {297 'ret': RET.PARAMERR,298 'msg': '没有权限'299 }300 else:301 # todo:回滚302 yield mysql_client.asyncioRollbackTransaction(transactionPoint)303 content = {304 'ret': RET.PARAMERR,305 'msg': '未知错误'306 }307 self.write(json_dumps(content))308 #todo:修改商品信息 ==>测试ok309 @gen.coroutine310 def put(self,*args,**kwargs):311 self.headers = {312 'content-type': 'application/json',313 'Authorization': 'Bearer ' + self.eslCloudClient.token314 }315 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')316 transactionPoint = transaction_info.get('point')317 # todo:获取参数318 barcode = self.get_argument('barcode', '') # 条形码319 qrcode = self.get_argument('qrcode', '') # 二维码320 label1 = barcode321 label2 = qrcode322 label3 = self.get_argument('label3', '')323 label4 = self.get_argument('label4', '')324 label5 = self.get_argument('label5', '')325 label6 = self.get_argument('label6', '')326 label7 = self.get_argument('label7', '')327 label8 = self.get_argument('label8', '')328 label9 = self.get_argument('label9', '')329 label10 = self.get_argument('label10', '')330 label11 = self.get_argument('label11', '')331 label12 = self.get_argument('label12', '')332 label13 = self.get_argument('label13', '')333 label14 = self.get_argument('label14', '')334 label15 = self.get_argument('label15', '')335 label16 = self.get_argument('label16', '')336 label17 = self.get_argument('label17', '')337 label18 = self.get_argument('label18', '')338 photo1 = self.get_argument('photo1', '')339 photo2 = self.get_argument('photo2', '')340 photo3 = self.get_argument('photo3', '')341 photo4 = self.get_argument('photo4', '')342 photo5 = self.get_argument('photo5', '')343 #todo:判断商品是否存在344 data = {345 'fields': ['barcode'],346 'eq': {347 'barcode': barcode348 },349 }350 data['database'] = 'aura'351 msg = yield mysql_client.tornadoSelectOnly('d_shop_goods', data)352 if not isinstance(msg, dict):353 content = {354 'ret': RET.PARAMERR,355 'msg': msg356 }357 return self.write(json_dumps(content))358 if msg['ret'] != '0':359 content = {360 'ret': RET.PARAMERR,361 'msg': '数据库查询错误'362 }363 return self.write(json_dumps(content))364 else:365 # todo:若不存在,新增商品信息366 if msg['lenght'] == 0:367 data = {368 'transactionPoint': transactionPoint,369 'msg': {370 "barcode": barcode,371 'create_time': datetime.datetime.now(),372 'update_time': datetime.datetime.now(),373 'is_delete': False,374 "qrcode": qrcode,375 "label1": label1,376 "label2": label2,377 "label3": label3,378 "label4": label4,379 "label5": label5,380 "label6": label6,381 "label7": label7,382 "label8": label8,383 "label9": label9,384 "label10": label10,385 "label11": label11,386 "label12": label12,387 "label13": label13,388 "label14": label14,389 "label15": label15,390 "label16": label16,391 "label17": label17,392 "label18": label18,393 "photo1": photo1,394 "photo2": photo2,395 "photo3": photo3,396 "photo4": photo4,397 "photo5": photo5,398 },399 }400 data['database'] = 'aura'401 msg = yield mysql_client.tornadoInsertOne('d_shop_goods', data)402 if not isinstance(msg, dict):403 content = {404 'ret': RET.DBERR,405 'msg': msg406 }407 return self.write(json_dumps(content))408 if msg['ret'] != '0':409 content = {410 'ret': RET.DBERR,411 'msg': '数据库插入错误'412 }413 return self.write(json_dumps(content))414 # todo:若存在,修改数据库信息415 else:416 data = {417 'transactionPoint': transactionPoint,418 'msg': {419 'update_time': datetime.datetime.now(),420 'is_delete': False,421 "qrcode": qrcode,422 "label1": label1,423 "label2": label2,424 "label3": label3,425 "label4": label4,426 "label5": label5,427 "label6": label6,428 "label7": label7,429 "label8": label8,430 "label9": label9,431 "label10": label10,432 "label11": label11,433 "label12": label12,434 "label13": label13,435 "label14": label14,436 "label15": label15,437 "label16": label16,438 "label17": label17,439 "label18": label18,440 "photo1": photo1,441 "photo2": photo2,442 "photo3": photo3,443 "photo4": photo4,444 "photo5": photo5,445 },446 'eq': {447 "barcode": barcode,448 }449 }450 data['database'] = 'aura'451 msg = yield mysql_client.tornadoUpdateMany('d_shop_goods', data)452 if not isinstance(msg, dict):453 content = {454 'ret': RET.DBERR,455 'msg': msg456 }457 return self.write(json_dumps(content))458 if msg['ret'] != '0':459 content = {460 'ret': RET.DBERR,461 'msg': '数据库修改错误'462 }463 return self.write(json_dumps(content))464 #todo:同步商品信息至ESL云465 shopGoods = {466 "goods": [467 {468 "barcode": barcode,469 "qrcode": qrcode,470 "label1": label1,471 "label2": label2,472 "label3": label3,473 "label4": label4,474 "label5": label5,475 "label6": label6,476 "label7": label7,477 "label8": label8,478 "label9": label9,479 "label10": label10,480 "label11": label11,481 "label12": label12,482 "label13": label13,483 "label14": label14,484 "label15": label15,485 "label16": label16,486 "label17": label17,487 "label18": label18,488 "photo1": photo1,489 "photo2": photo2,490 "photo3": photo3,491 "photo4": photo4,492 "photo5": photo5,493 },494 ],495 "storeUuid": self.storeCode # 必填参数门店编码496 }497 url = self.eslCloudClient.goodsUrl498 result = yield asyncTornadoRequest(url, method='PUT', headers=self.headers, body=shopGoods)499 status = result.get('status')500 if status == 200:501 # todo:数据提交502 yield mysql_client.asyncioCommitTransaction(transactionPoint)503 content = {504 'ret': RET.OK,505 'msg': '商品修改成功'506 }507 elif status == 400:508 # todo:回滚509 yield mysql_client.asyncioRollbackTransaction(transactionPoint)510 content = {511 'ret': RET.PARAMERR,512 'msg': '没有此门店编码'513 }514 elif status == 401:515 # todo:回滚516 yield mysql_client.asyncioRollbackTransaction(transactionPoint)517 content = {518 'ret': RET.PARAMERR,519 'msg': '门店编码为空'520 }521 elif status == 404:522 # todo:回滚523 yield mysql_client.asyncioRollbackTransaction(transactionPoint)524 content = {525 'ret': RET.PARAMERR,526 'msg': '没有权限'527 }528 else:529 # todo:回滚530 yield mysql_client.asyncioRollbackTransaction(transactionPoint)531 content = {532 'ret': RET.PARAMERR,533 'msg': '未知错误'534 }535 # todo:判断商品是否绑定标签536 data = {537 'fields': ['mac'],538 'eq': {539 'is_delete': False,540 'barcode': barcode541 },542 }543 msg = yield mysql_client.tornadoSelectOnly('d_label_binding_goods', data)544 if not isinstance(msg, dict):545 content = {546 'ret': RET.PARAMERR,547 'msg': msg548 }549 return self.write(json_dumps(content))550 if msg['ret'] != '0':551 content = {552 'ret': RET.PARAMERR,553 'msg': '数据库查询错误'554 }555 return self.write(json_dumps(content))556 else:557 # todo:若已绑定标签,推送商品信息558 if msg['lenght'] != 0:559 shopGoods = {560 "information": {561 "barcode": barcode,562 'create_time': datetime.datetime.now(),563 'update_time': datetime.datetime.now(),564 'is_delete': False,565 "qrcode": qrcode,566 "label1": label1,567 "label2": label2,568 "label3": label3,569 "label4": label4,570 "label5": label5,571 "label6": label6,572 "label7": label7,573 "label8": label8,574 "label9": label9,575 "label10": label10,576 "label11": label11,577 "label12": label12,578 "label13": label13,579 "label14": label14,580 "label15": label15,581 "label16": label16,582 "label17": label17,583 "label18": label18,584 "photo1": photo1,585 "photo2": photo2,586 "photo3": photo3,587 "photo4": photo4,588 "photo5": photo5,589 },590 "storeUuid": self.storeCode # 必填参数 门店编码591 }592 url = self.eslCloudClient.goodBrushUrl593 result = yield asyncTornadoRequest(url, method='POST', headers=self.headers, body=shopGoods)594 status = result.get('status')595 data = result.get('data')596 if status == 200:597 content = []598 for d in data:599 code = d.get('code')600 if code == '201':601 content_info = {602 'msg': '商品修改成功,标签没有绑定网关'603 }604 content.append(content_info)605 elif code == '202':606 content_info = {607 'msg': '商品修改成功,标签没有导入'608 }609 content.append(content_info)610 elif code == '203':611 content_info = {612 'msg': '商品修改成功,刷图异常'613 }614 content.append(content_info)615 else:616 content_info = {617 'msg': '商品修改成功,未知信息'618 }619 content.append(content_info)620 elif status == 400:621 content = {622 'ret': RET.PARAMERR,623 'msg': '商品修改成功,没有此门店编码'624 }625 elif status == 401:626 content = {627 'ret': RET.PARAMERR,628 'msg': '商品修改成功,门店编码为空'629 }630 elif status == 404:631 content = {632 'ret': RET.PARAMERR,633 'msg': '商品修改成功,没有权限'634 }635 elif status == 405:636 content = {637 'ret': RET.PARAMERR,638 'msg': '商品修改成功,条形码错误'639 }640 elif status == 406:641 content = {642 'ret': RET.PARAMERR,643 'msg': '商品修改成功,商品没有绑定标签'644 }645 else:646 content = {647 'ret': RET.PARAMERR,648 'msg': '商品修改成功,未知错误'649 }650 self.write(json_dumps(content))651 #todo:删除商品信息 ==>测试ok652 @gen.coroutine653 def delete(self,*args,**kwargs):654 self.headers = {655 'content-type': 'application/json',656 'Authorization': 'Bearer ' + self.eslCloudClient.token657 }658 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')659 transactionPoint = transaction_info.get('point')660 #todo:获取参数661 barcodes = self.get_argument('barcodes', '') # 条形码662 barcode_list = barcodes.split('%')663 while '' in barcode_list:664 barcode_list.remove('')665 if not all([barcodes]):666 content = {667 'ret':RET.PARAMERR,668 'msg':'条形码参数未知'669 }670 return self.write(json_dumps(content))671 shopGoods = {672 "goods": [],673 "storeUuid": self.storeCode674 }675 for barcode in barcode_list:676 shopGoods['goods'] = [{'barcode':barcode}]677 # todo:判断barcode是否存在678 data = {679 'fields': ['barcode'],680 'eq': {681 'is_delete': False,682 'barcode': barcode683 },684 }685 data['database'] = 'aura'686 msg = yield mysql_client.tornadoSelectOnly('d_shop_goods', data)687 if not isinstance(msg, dict):688 content = {689 'ret': RET.PARAMERR,690 'msg': msg691 }692 return self.write(json_dumps(content))693 if msg['ret'] != '0':694 content = {695 'ret': RET.PARAMERR,696 'msg': '数据库查询错误'697 }698 return self.write(json_dumps(content))699 else:700 if msg['lenght'] != 0:701 #todo:数据库删除商品702 data = {703 'transactionPoint': transactionPoint,704 'msg': {705 'update_time': datetime.datetime.now(),706 'is_delete': True,707 },708 'eq': {709 "barcode": barcode,710 }711 }712 data['database'] = 'aura'713 msg = yield mysql_client.tornadoUpdateMany('d_shop_goods', data)714 if not isinstance(msg, dict):715 content = {716 'ret': RET.DBERR,717 'msg': msg718 }719 return self.write(json_dumps(content))720 if msg['ret'] != '0':721 content = {722 'ret': RET.DBERR,723 'msg': '数据库修改错误'724 }725 return self.write(json_dumps(content))726 #todo:ESL云删除727 url = self.eslCloudClient.goodsUrl728 result = yield asyncTornadoRequest(url, method='DELETE', headers=self.headers, body=shopGoods,allow_nonstandard_methods=True)729 status = result.get('status')730 if status == 200:731 # todo:数据提交732 yield mysql_client.asyncioCommitTransaction(transactionPoint)733 elif status == 400:734 # todo:回滚735 yield mysql_client.asyncioRollbackTransaction(transactionPoint)736 content = {737 'ret': RET.PARAMERR,738 'msg': '没有此门店编码'739 }740 self.write(json_dumps(content))741 elif status == 401:742 # todo:回滚743 yield mysql_client.asyncioRollbackTransaction(transactionPoint)744 content = {745 'ret': RET.PARAMERR,746 'msg': '门店编码为空'747 }748 self.write(json_dumps(content))749 elif status == 404:750 # todo:回滚751 yield mysql_client.asyncioRollbackTransaction(transactionPoint)752 content = {753 'ret': RET.PARAMERR,754 'msg': '没有权限'755 }756 self.write(json_dumps(content))757 else:758 # todo:回滚759 yield mysql_client.asyncioRollbackTransaction(transactionPoint)760 content = {761 'ret': RET.PARAMERR,762 'msg': '未知错误'763 }764 self.write(json_dumps(content))765 else:766 content = {767 'ret': RET.OK,768 'msg': '商品删除成功'769 }770 self.write(json_dumps(content))771class ControlView(web.RequestHandler):772 @gen.coroutine773 def initialize(self, server):774 self.eslCloudClient = server.eslCloudClient775 self.ioloop = server.ioloop776 self.storeCode = server.eslCloudClient.storeCode777 #todo:获取模板id778 @gen.coroutine779 def get(self,*args,**kwargs):780 self.headers = {781 'content-type': 'application/json',782 'Authorization': 'Bearer ' + self.eslCloudClient.token783 }784 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')785 transactionPoint = transaction_info.get('point')786 page = self.get_argument('page','')787 size = self.get_argument('size','')788 name = self.get_argument('name','')789 if not all([page,size]):790 content = {791 'ret': RET.PARAMERR,792 'msg': '参数错误'793 }794 return self.write(json_dumps(content))795 data = {796 'page': page,797 'size': size,798 'storeUuid':self.storeCode,799 'name':name800 }801 url = self.eslCloudClient.templateUrl802 result = yield asyncTornadoRequest(url, method='GET', headers=self.headers,params=data)803 self.write(json_dumps(result))804 #todo:绑定标签 ==>测试ok805 @gen.coroutine806 def post(self,*args,**kwargs):807 #todo:公共参数808 self.headers = {809 'content-type': 'application/json',810 'Authorization': 'Bearer ' + self.eslCloudClient.token811 }812 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')813 transactionPoint = transaction_info.get('point')814 #todo:获取参数815 barcode = self.get_argument('barcode', '') # 条形码816 template = self.get_argument('template','') # 模板id817 mac = self.get_argument('mac', '') # 标签mac818 if not all([barcode,template,mac]):819 content = {820 'ret': RET.PARAMERR,821 'msg': '参数不全'822 }823 return self.write(json_dumps(content))824 #todo:查询标签和商品是否绑定825 data = {826 'fields': ['guid'],827 'eq': {828 'barcode': barcode,829 'mac':mac830 },831 }832 data['database'] = 'aura'833 msg = yield mysql_client.tornadoSelectOnly('d_label_binding_goods', data)834 if not isinstance(msg, dict):835 content = {836 'ret': RET.PARAMERR,837 'msg': msg838 }839 return self.write(json_dumps(content))840 if msg['ret'] != '0':841 content = {842 'ret': RET.PARAMERR,843 'msg': '数据库查询错误'844 }845 return self.write(json_dumps(content))846 else:847 guid_list = [x['guid'] for x in msg['msg']]848 # todo:若没有绑定,则新增绑定关系849 if msg['lenght'] == 0:850 data = {851 'transactionPoint': transactionPoint,852 'msg': {853 'guid': uuid.uuid1().urn.split(':')[2],854 'create_time': datetime.datetime.now(),855 'update_time': datetime.datetime.now(),856 'is_delete': False,857 "barcode": barcode,858 'mac':mac,859 'template':template,860 },861 }862 data['database'] = 'aura'863 msg = yield mysql_client.tornadoInsertOne('d_label_binding_goods', data)864 if not isinstance(msg, dict):865 content = {866 'ret': RET.DBERR,867 'msg': msg868 }869 return self.write(json_dumps(content))870 if msg['ret'] != '0':871 content = {872 'ret': RET.DBERR,873 'msg': '数据库插入错误'874 }875 return self.write(json_dumps(content))876 # todo:若绑定,则修改绑定规则(模板id)877 else:878 data = {879 'transactionPoint': transactionPoint,880 'msg': {881 'update_time': datetime.datetime.now(),882 'is_delete': False,883 "barcode": barcode,884 'mac': mac,885 'template': template,886 },887 'eq': {888 "guid": guid_list,889 }890 }891 data['database'] = 'aura'892 msg = yield mysql_client.tornadoUpdateMany('d_label_binding_goods', data)893 if not isinstance(msg, dict):894 content = {895 'ret': RET.DBERR,896 'msg': msg897 }898 return self.write(json_dumps(content))899 if msg['ret'] != '0':900 content = {901 'ret': RET.DBERR,902 'msg': '数据库修改错误'903 }904 return self.write(json_dumps(content))905 data = {906 "procBindings": [907 {908 "barcode": barcode, #条形码909 "demoId": template, #模板id910 "mac": mac #标签Mac地址911 },912 ],913 "storeUuid": self.storeCode # 必填参数 门店编码914 }915 url = self.eslCloudClient.bindingUrl916 result = yield asyncTornadoRequest(url, method='POST', headers=self.headers, body=data)917 status = result.get('status')918 data = result.get('data')919 if status == 200:920 content = []921 for d in data:922 code = d.get('code')923 if code == '200':924 # todo:数据提交925 yield mysql_client.asyncioCommitTransaction(transactionPoint)926 content_info = {927 '标签':d.get('message'),928 'msg': '商品绑定成功'929 }930 content.append(content_info)931 elif code == '205':932 # todo:数据提交933 yield mysql_client.asyncioCommitTransaction(transactionPoint)934 content_info = {935 '标签':d.get('message'),936 'msg': '商品已绑定'937 }938 content.append(content_info)939 elif code == '206':940 # todo:回滚941 yield mysql_client.asyncioRollbackTransaction(transactionPoint)942 content_info = {943 '标签': d.get('message'),944 'msg': '没有此商品信息,请先导入或添加'945 }946 content.append(content_info)947 elif code == '207':948 # todo:回滚949 yield mysql_client.asyncioRollbackTransaction(transactionPoint)950 content_info = {951 '标签': d.get('message'),952 'msg': '没有此标签信息,请先导入'953 }954 content.append(content_info)955 elif code == '208':956 content_info = {957 '标签': d.get('message'),958 'msg': '商品绑定成功'959 }960 content.append(content_info)961 else:962 # todo:回滚963 yield mysql_client.asyncioRollbackTransaction(transactionPoint)964 content_info = {965 'msg': '未知信息'966 }967 content.append(content_info)968 elif status == 400:969 # todo:回滚970 yield mysql_client.asyncioRollbackTransaction(transactionPoint)971 content = {972 'ret': RET.PARAMERR,973 'msg': '没有此门店编码'974 }975 else:976 # todo:回滚977 yield mysql_client.asyncioRollbackTransaction(transactionPoint)978 content = {979 'ret': RET.PARAMERR,980 'msg': '未知错误'981 }982 self.write(json_dumps(content))983 #todo:删除绑定 ==>测试ok984 @gen.coroutine985 def delete(self,*args,**kwargs):986 #todo:公共参数987 self.headers = {988 'content-type': 'application/json',989 'Authorization': 'Bearer ' + self.eslCloudClient.token990 }991 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')992 transactionPoint = transaction_info.get('point')993 #todo:获取参数994 macs = self.get_argument('macs')995 mac_list = macs.split('%')996 while '' in mac_list:997 mac_list.remove('')998 if not all([mac_list]):999 content = {1000 'ret':RET.PARAMERR,1001 'msg':'mac地址错误'1002 }1003 return self.write(json_dumps(content))1004 for mac in mac_list:1005 #todo:判断mac标签是否存在1006 data = {1007 'fields': ['mac'],1008 'eq': {1009 'is_delete': False,1010 'mac': mac1011 },1012 }1013 data['database'] = 'aura'1014 msg = yield mysql_client.tornadoSelectOnly('d_label_device', data)1015 if not isinstance(msg, dict):1016 content = {1017 'ret': RET.PARAMERR,1018 'msg': msg1019 }1020 return self.write(json_dumps(content))1021 if msg['ret'] != '0':1022 content = {1023 'ret': RET.PARAMERR,1024 'msg': '数据库查询错误'1025 }1026 return self.write(json_dumps(content))1027 #todo:删除标签绑定关系1028 data = {1029 'transactionPoint': transactionPoint,1030 'msg': {1031 'update_time': datetime.datetime.now(),1032 'is_delete': True,1033 },1034 'eq': {1035 "mac": mac,1036 }1037 }1038 data['database'] = 'aura'1039 msg = yield mysql_client.tornadoUpdateMany('d_label_binding_goods', data)1040 if not isinstance(msg, dict):1041 content = {1042 'ret': RET.DBERR,1043 'msg': msg1044 }1045 return self.write(json_dumps(content))1046 if msg['ret'] != '0':1047 content = {1048 'ret': RET.DBERR,1049 'msg': '数据库修改错误'1050 }1051 return self.write(json_dumps(content))1052 data = {1053 "storeUuid": self.storeCode # 必填参数 门店编码1054 }1055 data['macs'] = [mac]1056 url = self.eslCloudClient.removeBindingUrl1057 result = yield asyncTornadoRequest(url, method='DELETE', headers=self.headers, body=data,allow_nonstandard_methods=True)1058 status = result.get('status')1059 if status == 200:1060 # todo:数据提交1061 yield mysql_client.asyncioCommitTransaction(transactionPoint)1062 elif status == 400:1063 # todo:回滚1064 yield mysql_client.asyncioRollbackTransaction(transactionPoint)1065 content = {1066 'ret': RET.PARAMERR,1067 'msg': '没有此门店编码'1068 }1069 self.write(json_dumps(content))1070 else:1071 # todo:回滚1072 yield mysql_client.asyncioRollbackTransaction(transactionPoint)1073 content = {1074 'ret': RET.PARAMERR,1075 'msg': '未知错误'1076 }1077 self.write(json_dumps(content))1078 content = {1079 'ret': RET.OK,1080 'msg': '标签删除绑定成功'1081 }1082 self.write(json_dumps(content))1083class BrushView(web.RequestHandler):1084 def initialize(self, server):1085 self.eslCloudClient = server.eslCloudClient1086 self.ioloop = server.ioloop1087 self.storeCode = server.eslCloudClient.storeCode1088 #todo:单个商品推送1089 @gen.coroutine1090 def post(self,*args,**kwargs):1091 self.headers = {1092 'content-type': 'application/json',1093 'Authorization': 'Bearer ' + self.eslCloudClient.token1094 }1095 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')1096 transactionPoint = transaction_info.get('point')1097 barcode = self.get_argument('barcode', '') # 条形码1098 if not all([barcode]):1099 content = {1100 'ret':RET.PARAMERR,1101 'msg':'条形码参数未知'1102 }1103 return self.write(json_dumps(content))1104 #todo:获取商品信息1105 data = {1106 'fields': ['barcode', 'qrcode', 'label1', 'label2', 'label3', 'label4', 'label5', 'label6', 'label7',1107 'label8',1108 'label9', 'label10', 'label11', 'label12', 'label13', 'label14', 'label15', 'label16', 'label17',1109 'label18',1110 'photo1', 'photo2', 'photo3', 'photo4', 'photo5'],1111 'eq': {1112 'is_delete': False,1113 'barcode':barcode,1114 },1115 'sortInfo': [1116 {'update_time': ''},1117 ]1118 }1119 data['database'] = 'aura'1120 msg = yield mysqlClient.tornadoSelectOnly('d_shop_goods', data)1121 if not isinstance(msg, dict):1122 content = {1123 'ret': RET.DBERR,1124 'msg': msg1125 }1126 return self.write(json_dumps(content))1127 if msg['ret'] != '0':1128 content = {1129 'ret': RET.DBERR,1130 'msg': '数据库查询错误'1131 }1132 return self.write(json_dumps(content))1133 else:1134 if msg['lenght'] == 0:1135 content = {1136 'ret': RET.DBERR,1137 'msg': '商品不存在'1138 }1139 return self.write(json_dumps(content))1140 goods_info = msg['msg'][0]1141 #todo:推送商品信息到标签1142 shopGoods = {1143 "information": {1144 "barcode": goods_info['barcode'],1145 "qrcode": goods_info['qrcode'],1146 "label1": goods_info['label1'],1147 "label2": goods_info['label2'],1148 "label3": goods_info['label3'],1149 "label4": goods_info['label4'],1150 "label5": goods_info['label5'],1151 "label6": goods_info['label6'],1152 "label7": goods_info['label7'],1153 "label8": goods_info['label8'],1154 "label9": goods_info['label9'],1155 "label10": goods_info['label10'],1156 "label11": goods_info['label11'],1157 "label12": goods_info['label12'],1158 "label13": goods_info['label13'],1159 "label14": goods_info['label14'],1160 "label15": goods_info['label15'],1161 "label16": goods_info['label16'],1162 "label17": goods_info['label17'],1163 "label18": goods_info['label18'],1164 "photo1": goods_info['photo1'],1165 "photo2": goods_info['photo2'],1166 "photo3": goods_info['photo3'],1167 "photo4": goods_info['photo4'],1168 "photo5": goods_info['photo5'],1169 },1170 "storeUuid": self.storeCode #必填参数 门店编码1171 }1172 url = self.eslCloudClient.goodBrushUrl1173 result = yield asyncTornadoRequest(url, method='POST', headers=self.headers, body=shopGoods)1174 status = result.get('status')1175 data = result.get('data')1176 if status == 200:1177 content = []1178 for d in data:1179 code = d.get('code')1180 if code == '201':1181 content_info = {1182 'msg': '标签没有绑定网关'1183 }1184 content.append(content_info)1185 elif code == '202':1186 content_info = {1187 'msg': '标签没有导入'1188 }1189 content.append(content_info)1190 elif code == '203':1191 content_info = {1192 'msg': '刷图异常'1193 }1194 content.append(content_info)1195 else:1196 content_info = {1197 'msg': '未知信息'1198 }1199 content.append(content_info)1200 content = {1201 'ret': RET.OK,1202 'msg': '商品推送成功'1203 }1204 elif status == 400:1205 content = {1206 'ret': RET.PARAMERR,1207 'msg': '没有此门店编码'1208 }1209 elif status == 401:1210 content = {1211 'ret': RET.PARAMERR,1212 'msg': '门店编码为空'1213 }1214 elif status == 404:1215 content = {1216 'ret': RET.PARAMERR,1217 'msg': '没有权限'1218 }1219 elif status == 405:1220 content = {1221 'ret': RET.PARAMERR,1222 'msg': '条形码错误'1223 }1224 elif status == 406:1225 content = {1226 'ret': RET.PARAMERR,1227 'msg': '商品没有绑定标签'1228 }1229 elif status == 201:1230 content = {1231 'ret': RET.PARAMERR,1232 'msg': '标签没有绑定网关'1233 }1234 elif status == 202:1235 content = {1236 'ret': RET.PARAMERR,1237 'msg': '标签没有导入'1238 }1239 elif status == 203:1240 content = {1241 'ret': RET.PARAMERR,1242 'msg': '刷图异常'1243 }1244 else:1245 content = {1246 'ret': RET.PARAMERR,1247 'msg': '未知错误'1248 }1249 self.write(json_dumps(content))1250 #todo:标签灯控制接口1251 @gen.coroutine1252 def put(self,*args,**kwargs):1253 self.headers = {1254 'content-type': 'application/json',1255 'Authorization': 'Bearer ' + self.eslCloudClient.token1256 }1257 transaction_info = yield mysqlClient.tornadoOpenTransaction('aura')1258 transactionPoint = transaction_info.get('point')1259 # storeUuid = self.get_argument('storeUuid', '') # 门店编码1260 mac = self.get_argument('mac', '') # 标签mac1261 color = self.get_argument('color','') # 灯的颜色 0 关闭,1:蓝色,2:绿色,3:红色1262 total = self.get_argument('total','') # 控制灯的总时间,单位s1263 period = self.get_argument('period','') #灯一次亮多久,单位ms1264 interval = self.get_argument('interval','') #灯多久亮一次,单位ms1265 brigthness = self.get_argument('brigthness','') #灯的亮度,1~100,亮度太低效果不明显1266 # if not all([storeUuid,mac]):1267 # content = {1268 # 'ret': RET.PARAMERR,1269 # 'msg': '门店编码或标签mac为空'1270 # }1271 # return self.write(json_dumps(content))1272 try:1273 color = int(color)1274 total = int(total)1275 period = int(period)1276 interval = int(interval)1277 brigthness = int(brigthness)1278 except:1279 content = {1280 'ret': RET.PARAMERR,1281 'msg': '控制参数错误'1282 }1283 return self.write(json_dumps(content))1284 data = {1285 'storeUuid':self.storeCode,1286 'mac':mac,1287 'color':color,1288 'total':total,1289 'period':period,1290 'interval':interval,1291 'brigthness':brigthness,1292 }1293 url = self.eslCloudClient.controlLedUrl1294 result = yield asyncTornadoRequest(url, method='PUT', headers=self.headers, params=data,body=data)1295 status = result.get('status')1296 if status == 200:1297 content = {1298 'ret': RET.OK,1299 'msg': 'LED控制成功成功'1300 }1301 elif status == 400:1302 content = {1303 'ret': RET.PARAMERR,1304 'msg': '没有此门店编码'1305 }1306 elif status == 401:1307 content = {1308 'ret': RET.PARAMERR,1309 'msg': '此mac地址错误或标签不存在'1310 }1311 elif status == 402:1312 content = {1313 'ret': RET.PARAMERR,1314 'msg': '标签没有绑定网关'1315 }1316 else:1317 content = {1318 'ret': RET.PARAMERR,1319 'msg': '未知错误'1320 }1321 self.write(json_dumps(content))1322class Callback(web.RedirectHandler):1323 def initialize(self, server):1324 self.eslCloudClient = server.eslCloudClient1325 self.ioloop = server.ioloop1326 self.storeCode = server.eslCloudClient.storeCode1327 self.meeting_room_list = server.meeting_room_list1328 @gen.coroutine1329 def post(self,*args,**kwargs):1330 try:1331 result = json.loads(self.request.body)1332 except:1333 content = {1334 'ret': 1,1335 'status': '错误'1336 }1337 self.write(json_dumps(content))1338 return1339 username = result.get('username')1340 code = result.get('code') #返回码1341 commodity = result.get('commodity') #商品条码1342 mac = result.get('mac') #标签mac码1343 operationType = result.get('operationType') #操作1344 storeUuid = result.get('storeUuid') #门店id1345 result = result.get('result') #回调说明1346 if commodity == None or mac == None:1347 return1348 for meeting_room in self.meeting_room_list:1349 for mac_id,lableDeviceInfo in meeting_room.labelDeviceDict.items():1350 if mac == mac_id:1351 meeting_room_object = meeting_room1352 for good_id, good in meeting_room_object.goods_dict.items():1353 if commodity == good_id:1354 goodObject = good1355 if code == 301 or code == '301': # 刷图成功1356 yield logClient.tornadoInfoLog('会议室:{},用户:{},进行对门店{},商品{},标签{},{}操作,结果为:{},编码为{}'.format(meeting_room_object.name,username, storeUuid,commodity, mac,operationType, result,code))1357 else: # 刷图失败1358 yield logClient.tornadoErrorLog('会议室:{},用户:{},进行对门店{},商品{},标签{},{}操作,结果为:{},编码为{}'.format(meeting_room_object.name,username, storeUuid,commodity, mac,operationType, result,code))1359 yield goodObject.updateLabelInfo(meeting_room_object.name,meeting_room_object.company_db,1,1)1360 return1361class TokenChangeView(web.RedirectHandler):1362 def initialize(self,server):1363 self.eslCloudClient = server.eslCloudClient1364 @gen.coroutine1365 def post(self,*args,**kwargs):1366 result = json.loads(self.request.body)1367 token = result.get('token')1368 self.eslCloudClient.token = token1369 content = {1370 'ret':01371 }...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

1from flask import Flask, render_template, session, redirect, url_for, request2from apscheduler.schedulers.background import BackgroundScheduler3from extend import db4import json5from datetime import timedelta6from blueprint.users import user_dp7from blueprint.validate_code import validate_code8from mail import send_mail9import config10import datetime11from pojo import *12from redis_cache import redis_cache13from blueprint.product import product_dp14app = Flask(__name__)15app.jinja_env.add_extension('jinja2.ext.loopcontrols')16app.register_blueprint(user_dp)17app.register_blueprint(validate_code)18app.register_blueprint(product_dp)19app.config.from_object(config)20db.init_app(app)21send_mail.init_app(app)22with app.app_context():23 db.create_all()24@app.route('/')25def index():26 productList = redis_cache.get('productList')27 productList1 = redis_cache.get('productList1')28 productList2 = redis_cache.get('productList2')29 productList3 = redis_cache.get('productList3')30 category = Category.query.all()31 # 热门产品32 if productList is None:33 products = Product.query.filter(Product.is_sell == 1, Product.is_pass == 2, Product.counts != 0).order_by(34 Product.click_count.desc()).slice(0, 10)35 productList = []36 for product in products:37 product = Product.product_json(product)38 productList.append(product)39 json_dumps = json.dumps(productList, ensure_ascii=False)40 print(json_dumps)41 redis_cache.set("productList", json_dumps)42 else:43 productList = productList.decode('utf8')44 productList = json.loads(productList)45 print(productList)46 # 新产品47 if productList1 is None:48 products = Product.query.filter(Product.is_sell == 1, Product.is_pass == 2, Product.counts != 0).order_by(49 Product.pdate.desc()).slice(0, 10)50 productList1 = []51 for product in products:52 product = Product.product_json(product)53 productList1.append(product)54 json_dumps = json.dumps(productList1, ensure_ascii=False)55 print(json_dumps)56 redis_cache.set("productList1", json_dumps)57 else:58 productList1 = productList1.decode('utf8')59 productList1 = json.loads(productList1)60 print(productList1)61 # 轮播图商品62 if productList2 is None:63 products = Product.query.filter(Product.is_hot == 2, Product.is_sell == 1, Product.is_pass == 2, Product.counts != 0).order_by(64 Product.pdate.desc()).slice(0, 3)65 productList2 = []66 for product in products:67 product = Product.product_json(product)68 productList2.append(product)69 json_dumps = json.dumps(productList2, ensure_ascii=False)70 print(json_dumps)71 redis_cache.set("productList2", json_dumps)72 else:73 productList2 = productList2.decode('utf8')74 productList2 = json.loads(productList2)75 print(productList2)76 # 最低价商品77 if productList3 is None:78 products = Product.query.filter(Product.is_sell == 1, Product.is_pass == 2, Product.counts != 0).order_by(79 Product.new_price.asc()).slice(0, 6)80 productList3 = []81 for product in products:82 product = Product.product_json(product)83 productList3.append(product)84 json_dumps = json.dumps(productList3, ensure_ascii=False)85 print(json_dumps)86 redis_cache.set("productList3", json_dumps)87 else:88 productList3 = productList3.decode('utf8')89 productList3 = json.loads(productList3)90 print(productList3)91 return render_template('user/index.html', hot_products=productList, new_products=productList1,92 extend_products=productList2, comment_products=productList3, categorys=category)93@app.context_processor94def my_context_processor():95 category_all = Category.query.all()96 categoryList = redis_cache.get('categoryList')97 if categoryList is None:98 categorys = Category.query.all()99 categoryList = []100 for category in categorys:101 category = Category.category_json(category)102 categoryList.append(category)103 json_dumps = json.dumps(categoryList, ensure_ascii=False)104 print(json_dumps)105 redis_cache.set("categoryList", json_dumps)106 else:107 categoryList = categoryList.decode('utf8')108 categoryList = json.loads(categoryList)109 print(categoryList)110 uid = session.get("uid")111 last_time = ""112 if uid is not None:113 user = User.query.get(uid)114 if user.shop_time is not None:115 shop_time = user.shop_time116 offset = timedelta(minutes=20)117 result_time = (shop_time + offset) - datetime.now()118 if result_time.days < 0:119 for shopCart in user.shopcarts:120 product = Product.query.get(shopCart.pid)121 product.counts = product.counts + shopCart.count122 db.session.delete(shopCart)123 db.session.commit()124 user.shop_time is None125 db.session.commit()126 last_time = ""127 else:128 m, s = divmod(result_time.seconds, 60)129 last_time = "" + str(m) + ":" + str(s)130 length = 0131 for shopCart in user.shopcarts:132 length += shopCart.count133 return {"uid": uid, "username": user.username, 'user_img': user.img_url, "categorys": categoryList,134 "category_all": category_all, "last_time": last_time, "length": length, "user": user}135 else:136 return {"categorys": categoryList, "category_all": category_all, "uid": "", "length": "0"}137def clear_redis():138 redis_cache.delete("userList")139 redis_cache.delete("productList1")140 redis_cache.delete("productList3")141@app.errorhandler(404)142def not_foundPage(error):143 return redirect(url_for('index'))144if __name__ == '__main__':...

Full Screen

Full Screen

test_vectors_plaintext_negative.py

Source:test_vectors_plaintext_negative.py Github

copy

Full Screen

1from authlib.common.encoding import json_dumps2from didcomm.errors import MalformedMessageError3from tests.test_vectors.common import TTestVectorNegative4INVALID_MESSAGES = [5 json_dumps({}),6 json_dumps("aaa"),7 json_dumps(8 {9 "typ": "application/didcomm-plain+json",10 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",11 "body": {},12 }13 ),14 json_dumps(15 {16 "id": "1234567890",17 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",18 "body": {},19 }20 ),21 json_dumps(22 {23 "id": "1234567890",24 "typ": "application/didcomm-plain+json",25 "body": {},26 }27 ),28 json_dumps(29 {30 "id": "1234567890",31 "typ": "application/didcomm-plain+json",32 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",33 }34 ),35 json_dumps(36 {37 "id": "1234567890",38 "typ": "application/didcomm-plain+json-unknown",39 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",40 "body": {},41 }42 ),43 json_dumps(44 {45 "id": "1234567890",46 "typ": "application/didcomm-plain+json",47 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",48 "body": {},49 "attachments": [{}],50 }51 ),52 json_dumps(53 {54 "id": "1234567890",55 "typ": "application/didcomm-plain+json",56 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",57 "body": {},58 "attachments": [{"id": "23"}],59 }60 ),61 json_dumps(62 {63 "id": "1234567890",64 "typ": "application/didcomm-plain+json",65 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",66 "body": {},67 "attachments": [{"id": "23", "data": {}}],68 }69 ),70 json_dumps(71 {72 "id": "1234567890",73 "typ": "application/didcomm-plain+json",74 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",75 "body": {},76 "attachments": [{"id": "23", "data": {"links": ["231", "212"]}}],77 }78 ),79 json_dumps(80 {81 "id": "1234567890",82 "typ": "application/didcomm-plain+json",83 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",84 "body": {},85 "attachments": "131",86 }87 ),88 json_dumps(89 {90 "id": "1234567890",91 "typ": "application/didcomm-plain+json",92 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",93 "body": {},94 "attachments": [2131],95 }96 ),97 json_dumps(98 {99 "id": "1234567890",100 "typ": "application/didcomm-plain+json",101 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",102 "body": {},103 "attachments": [{"id": 2}],104 }105 ),106 json_dumps(107 {108 "id": "1234567890",109 "typ": "application/didcomm-plain+json",110 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",111 "body": {},112 "attachments": [{"id": "1", "data": None}],113 }114 ),115 json_dumps(116 {117 "id": "1234567890",118 "typ": "application/didcomm-plain+json",119 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",120 "body": {},121 "attachments": [{"id": "1", "data": "None"}],122 }123 ),124 json_dumps(125 {126 "id": "1234567890",127 "typ": "application/didcomm-plain+json",128 "type": "http://example.com/protocols/lets_do_lunch/1.0/proposal",129 "body": {},130 "attachments": [{"id": "1", "data": "None"}],131 }132 ),133 # TODO: add more134]135INVALID_PLAINTEXT_TEST_VECTORS = [136 TTestVectorNegative(value, MalformedMessageError) for value in INVALID_MESSAGES...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful