import aiohttp
import asyncio
import os
os.environ["HOST_IP"]='172.56.56.123'
host_ip=os.environ["HOST_IP"]
print(host_ip,type(host_ip))
http_local_linux='http://'+host_ip+':5050/v1/sim'
print(http_local_linux,type(http_local_linux))
http_local='http://172.16.101.142:5052/v1/sim'
http_211='http://172.16.100.211:5050/v1/sim'
http_ral='http://10.0.101.250:5050/v1/sim'
async def request_(msg):
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=5)) as session:
async with session.request(method="post",url=http_211,json={"message":msg}) as response:
return await response.json()
async def main(msg):
text = await request_(msg)
return text
# a=main('怎么新增建表')
# print(a)
#
# text = asyncio.get_event_loop().run_until_complete(main('实时'))
# print(text)
#
aiohttp------------------------
最新推荐文章于 2024-07-07 10:06:43 发布