-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Long story short
I'm connecting to an IOT device (airconditioner) with a REST interface.
Posting commands using >=3.0 doesn't work. The post goes through and the status OK is returned, but there's some issue with the TCP connection.
Steps to reproduce
Within the wireshark packet capture there's two different TCP transactions with exactly the same aiohttp code running (also within the zip file). The short version of the code without imports etc looks like this:
device_ip = '10.0.0.107'
async def send_command_async(command: str, data: Any):
body = {command : data}
url = f"http://{device_ip}/{command}"
async with ClientSession() as session:
async with session.post(url, json=body) as response:
response.raise_for_status()
loop: AbstractEventLoop = asyncio.get_event_loop()
loop.run_until_complete(loop.create_task(send_command_async('SystemMODE', 'heat')))
If you get aiohttp<3.0 you get the first packet capture, up until packet 10. Everything is happy.
With the latest version and any version above 3.0, all goes well until the ACK gets sent for the OK packet, then a whole spume of out of order and dup ack packets goes back and forth.
I can't actually see any difference in what gets sent or anything. It's possible it's the device that's the issue, I've emailed the guys that produce the device so they are on this issue too, but the low level TCP stuff is a bit beyond me.
The odd thing is that http GET works just fine.
Environment
- Python 3.6
- Windows 10
- Latest aiohttp (but did a regression test back until <3.0 version)
- The device is an iZone air conditioner