1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

Update protobuf to actix-web 2.0.0 (#249)

* Update to actix-web 2.0.0

* Add README.md
This commit is contained in:
Elliot Jackson
2020-02-06 18:17:23 +01:00
committed by GitHub
parent d59129c212
commit 443b8197ed
6 changed files with 69 additions and 50 deletions

View File

@ -1,14 +1,16 @@
#!/usr/bin/env python3
# just start server and run client.py
# wget https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-python-3.5.1.zip
# unzip protobuf-python-3.5.1.zip.1
# cd protobuf-3.5.1/python/
# python3.6 setup.py install
# wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protobuf-python-3.11.2.zip
# unzip protobuf-python-3.11.2.zip
# cd protobuf-3.11.2/python/
# python3 setup.py install
# pip3.6 install --upgrade pip
# pip3.6 install aiohttp
# pip3 install --upgrade pip
# pip3 install aiohttp
# python3 client.py
#!/usr/bin/env python
import test_pb2
import traceback
import sys
@ -46,7 +48,7 @@ async def fetch(session):
obj = test_pb2.MyObj()
obj.number = 9
obj.name = 'USB'
async with session.post('http://localhost:8081/', data=obj.SerializeToString(),
async with session.post('http://127.0.0.1:8081/', data=obj.SerializeToString(),
headers={"content-type": "application/protobuf"}) as resp:
print(resp.status)
data = await resp.read()
@ -63,4 +65,4 @@ async def go(loop):
loop = asyncio.get_event_loop()
loop.run_until_complete(go(loop))
loop.close()
loop.close()