I am in trouble using aiohttp Python module: in some cases (not always, no patterns, just happens randomly), the get method produce an unexpected URI...
My client code is something like this (the URI is dummy):
 # Python 3
 import aiohttp, async
 async with aiohttp.ClientSession() as session:
       URI = 'https://apiprovider.io/route?paran1=hi&key=hsaf4ed8f4ad6f874asd'
       async with session.get(URI) as response:
              result_data = await response.json()
The error message (not allways, but randomly):
 aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with 
 unexpected mimetype: ', url=URL('https://apiprovider.io/route?paran1=hi&key=hsaf4ed8f4ad6f874asd')
Python accuses an "decode JSON" error, but it is just a consequence of the real problem.
The server response is: {"status":"ERROR","request_id":"random_numb","error":"Unknown API Key"}
The key "error":"Unknow API key" is caused because the module (or something in the way) change de URI.
The original URI becames https://apiprovider.io/route?paran1=hi&key=hsaf4ed8f4ad6f874asd'
Please, note the single cote in the end of the string, it seems to became part of the URI itself... exactly in the "key" param.
If I use the same URI in my browser, just removing the single cote in the end, the result is correct.
Can someone explain to me why this happens and how can I fix it?
I already try to change the order of URI params, and also try to use the "params" param in the get method like this:
 [...]
 async with session.get(URI, params={'key':key, 'param1'=hi}) as response:
 [...]
None of this works... The erros stops for a while, but come back eventualy.
Thank you very much!
 
    