python 3.6.2 ,应用作为客户端,用 aiohttp 方式访问 http服务器,代码如下:
async def call_phone(self): data = """ <?xml version="1.0" encoding="utf-8" ?> <Transfer attribute="Connect"> <ext id="216"/> <outer to="1871234567"/> </Transfer> """ headers = {"Content-Type":"text/xml"} async with aiohttp.ClientSession() as session: async with session.post(self.phone_uri, data=data) as resp: resp_data = await resp.text() print(resp_data)
运行报错 aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
服务端主动断开了连接,原因可能有很多,这个http服务器是自己开发的吗?