Skip to content

Error when sending get requests, might be related to redirects. #2479

@Zwork101

Description

@Zwork101

I'm sending a simple get request,

async with self.session.get(self.CONF_URL + '/conf', params=params, headers=headers) as resp:

And I'm looking to receive html back, but it raises this error:

Traceback (most recent call last):
  File "C:\Users\Zwork101\PycharmProjects\python-trade\pytrade\confirmations.py", line 73, in get_confirmations
    async with self.session.get(self.CONF_URL + '/conf', params=params, headers=headers) as resp:
  File "C:\Users\Zwork101\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 692, in __aenter__
    self._resp = yield from self._coro
  File "C:\Users\Zwork101\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 264, in _request
    ssl_context=ssl_context, proxy_headers=proxy_headers)
  File "C:\Users\Zwork101\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client_reqrep.py", line 105, in __init__
    url2 = url.with_query(params)
  File "C:\Users\Zwork101\AppData\Local\Programs\Python\Python36-32\lib\site-packages\yarl\__init__.py", line 768, in with_query
    "should be str or int, got {!r}".format(v))
TypeError: Invalid variable type: mapping value should be str or int, got b'Some bytes here'

This is the first half of the function, where the problem lies

    async def get_confirmations(self):
        confs = ''
        params = self._create_confirmation_params('conf')
        headers = {'X-Requested-With': 'com.valvesoftware.android.steam.community'}
        async with self.session.get(self.CONF_URL + '/conf', params=params, headers=headers) as resp:
            if 'incorrect Steam Guard codes.' in resp.text():
                raise ValueError('Invalid identity_secret')
            confs = await resp.text()

I'm using python 3.6.1, and I used to be using an older version of aiohttp with the same code, and got a different error, one related to redirects. Then, I did pip install -U aiohttp, and now I'm getting this. Using the client version of aiohttp.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions