Problem with response (Chunked response) testnet.binancefuture.com

Good day.
I use python and aiohttp library for sending request to https://testnet.binancefuture.com/.
Endpoint - ACCOUNT_BALANCE = ‘/fapi/v2/balance’ and ACCOUNT_INFORMATION_V2 = /fapi/v2/account’.
Type - GET.
My headers:
‘Content-Type’: ‘application/json;charset=utf-8’,
‘X-MBX-APIKEY’: “public_key”

I have a problem. When I send 4 reqeust for different account, time to time I getting not full answer with “Chunked” parametr in accept headers. (from time to time I get full responses, and sometimes 1-2 of the requests are returned with the chunked status)

My question is how to handle chunked responses?

tried the following code:

   async with aiohttp.ClientSession() as sess:
       async with sess.get ('url', headers=self.headers) as response:
          while True:
             chunk = await r.content.read(chunk_size)
             print(chunk)
             if not chunk:
                break

but still the answer is correct and does not arrive in full volume. Out of 2500 bytes, only 100-200 bytes arrive, and then it feels like the connection is broken.

I googled this question and studied the documentation, unfortunately I could not find an answer.

The same endpoint on https://fapi.binance.com works well!

We observed some issue with these two endpoints on testnet. Working on it

1 Like

Should be good now. If you still have problem, please share the whole code with confidential information masked

1 Like

Thanks! It’s solved. Working well right now.