Having a strange issue while trying to use aiohttp/asyncio with Artifactory REST API.
The strange thing is that the below code works perfectly for 'url_2' but permanently fails with aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed
for 'url_1'. As you can see, there is absolutely no difference between these URLs.
import aiohttp
import asyncio
user_name = 'username'
user_password = 'password'
url_1 = 'https://someorg.jfrog.io/someorg/api/storage/repo/folder-xxx' # fails
url_2 = 'https://someorg.jfrog.io/someorg/api/storage/repo/folder-yyy' # works
async def fetch(url, user_name, user_password):
async with aiohttp.ClientSession(auth=aiohttp.BasicAuth(user_name, user_password)) as session:
remote_resp = await session.request("GET", url)
return await remote_resp.json()
r = asyncio.run(fetch(url_1, user_name, user_password))
print(r)
I am thinking that this has something to do with chunks, as they state it here: https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientPayloadError
class aiohttp.ClientPayloadError
This exception can only be raised while reading the response payload if one of these errors occurs:
- invalid compression
- malformed chunked encoding
- not enough data that satisfy Content-Length HTTP header.
Literally stuck and have no ideas :( FYI: duplicated issue to aio-lib at https://github.com/aio-libs/aiohttp/issues/2076
Could anyone point the direction to at least debug and define the root cause?