You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/usr/local/lib/python3.11/dist-packages/botasaurus_requests/reqs.py", line 365, in post
fix_headers(kwargs)
│ └ {'data': {'var': 'true'}, 'timeout': 10, 'allow_redirects': True, 'browser': 'firefox', 'proxy': 'http://x.x.x.x:xxxx'}
└ <function fix_headers at 0x7f9c11eff600>
File "/usr/local/lib/python3.11/dist-packages/botasaurus_requests/reqs.py", line 323, in fix_headers
if isinstance(kwargs['headers'], dict):
└ {'data': {'var': 'true'}, 'timeout': 10, 'allow_redirects': True, 'browser': 'firefox', 'proxy': 'http://[72.10.160.172:16327'](x.x.x.x:xxxx')}
Seems like the code here, is not checks if the headers exists, look like it is mandantory to fil them. If i comment out the code, the botasaurus is working.
File: botasaurus_requests/reqs.py
Line: 323
if isinstance(kwargs['headers'], dict):
# fix bug for ints not working
for key, value in kwargs['headers'].items():
# if isinstance(kwargs['headers'], int):
kwargs['headers'][key] = str(value)
I think that the problem will be solved if we use the following:
headers = kwargs.get('headers')
if isinstance(headers, dict):
or:
if 'headers' in kwargs and isinstance(kwargs['headers'], dict):
The text was updated successfully, but these errors were encountered:
JimKarvo
changed the title
KeyError: 'headers'
KeyError: 'headers' at file reqs.py:323 [Possible solution suggested]
Aug 13, 2024
Hello,
the following code:
produces the following error:
Seems like the code here, is not checks if the headers exists, look like it is mandantory to fil them. If i comment out the code, the botasaurus is working.
File: botasaurus_requests/reqs.py
Line: 323
I think that the problem will be solved if we use the following:
or:
The text was updated successfully, but these errors were encountered: