()
| 19 | import aiohttp |
| 20 | |
| 21 | def op(): |
| 22 | try: |
| 23 | obj = test_pb2.MyObj() |
| 24 | obj.number = 9 |
| 25 | obj.name = 'USB' |
| 26 | |
| 27 | #Serialize |
| 28 | sendDataStr = obj.SerializeToString() |
| 29 | #print serialized string value |
| 30 | print('serialized string:', sendDataStr) |
| 31 | #------------------------# |
| 32 | # message transmission # |
| 33 | #------------------------# |
| 34 | receiveDataStr = sendDataStr |
| 35 | receiveData = test_pb2.MyObj() |
| 36 | |
| 37 | #Deserialize |
| 38 | receiveData.ParseFromString(receiveDataStr) |
| 39 | print('pares serialize string, return: devId = ', receiveData.number, ', name = ', receiveData.name) |
| 40 | except(Exception, e): |
| 41 | print(Exception, ':', e) |
| 42 | print(traceback.print_exc()) |
| 43 | errInfo = sys.exc_info() |
| 44 | print(errInfo[0], ':', errInfo[1]) |
| 45 | |
| 46 | |
| 47 | async def fetch(session): |
nothing calls this directly
no outgoing calls
no test coverage detected