Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error received after updating the requests package #73

Closed
MehmetAzizYirik opened this issue Sep 1, 2016 · 7 comments · Fixed by #128
Closed

Error received after updating the requests package #73

MehmetAzizYirik opened this issue Sep 1, 2016 · 7 comments · Fixed by #128

Comments

@MehmetAzizYirik
Copy link

Hi guys;

I just tried to extract data by using the URL of the webservices; moreover, I used the requests package however it returned the error "TypeError: str returned non-string (type SysCallError)" according to that; I just read the section for the issue at GitHub and upgraded the requests package. However, it returned another error. Before updating the code worked for an hour and stopped and gave the error as I shared "TypeError: str returned non-string (type SysCallError)" however right now it does not work; moreover jit just returns the traceback:

Traceback (most recent call last):
File "C:\Users\may\Desktop\Documents\BOUN-CSE\Master Thesis\Project Code Files\pubchem\PubchemMapping.py", line 35, in
activities = new_client.activity.filter(target_chembl_id__in=[target['target_chembl_id'] for target in targets])
File "C:\Python27\lib\site-packages\chembl_webresource_client\query_set.py", line 114, in next
self.chunk = self.query.get_page()
File "C:\Python27\lib\site-packages\chembl_webresource_client\url_query.py", line 390, in get_page
res = session.post(self.base_url + '.' + self.frmt, data=data, timeout=self.timeout)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 522, in post
return self.request('POST', url, data=data, json=json, _kwargs)
File "C:\Python27\lib\site-packages\requests_cache\core.py", line 126, in request
*kwargs
File "C:\Python27\lib\site-packages\requests\sessions.py", line 475, in request
resp = self.send(prep, *_send_kwargs)
File "C:\Python27\lib\site-packages\requests_cache\core.py", line 97, in send
response, timestamp = self.cache.get_response_and_time(cache_key)
File "C:\Python27\lib\site-packages\requests_cache\backends\base.py", line 70, in get_response_and_time
if key not in self.responses:
File "C:\Python27\lib_abcoll.py", line 388, in contains
self[key]
File "C:\Python27\lib\site-packages\requests_cache\backends\storage\dbdict.py", line 163, in getitem
return pickle.loads(bytes(super(DbPickleDict, self).getitem(key)))
File "C:\Python27\lib\copy_reg.py", line 50, in reconstructor
obj = base._new(cls, state)
TypeError: ('dict.new(HTTPHeaderDict): HTTPHeaderDict is not a subtype of dict', , (, , {'date': ('date', 'Thu, 01 Sep 2016 08:24:03 GMT'), 'transfer-encoding': ('transfer-encoding', 'chunked'), 'vary': ('vary', 'Accept'), 'server': ('server', 'gunicorn/19.1.1'), 'x-chembl-retrieval-time': ('x-chembl-retrieval-time', '0.00829792022705'), 'connection': ('connection', 'Keep-Alive'), 'cache-control': ('cache-control', 's-maxage=30000000, max-age=30000000'), 'x-chembl-in-cache': ('x-chembl-in-cache', 'True'), 'content-type': ('content-type', 'application/json')}))

Can you help to solve the problem please ?

In addition; I also upgraded the requests-cache however the code returned the same error. Please show me how to solve the problem.

All the Best;
Aziz

@reclosedev
Copy link
Collaborator

If it's possible to run the script again, you could try to remove old cache file (or rename it).

@reclosedev
Copy link
Collaborator

related #56

@MehmetAzizYirik
Copy link
Author

@reclosedev what do you mean with the old cache file ? Actually I am new with python

@MehmetAzizYirik
Copy link
Author

@reclosedev actually I searched for it however I just wanna be sure about what you mean

@dangelovich
Copy link

Same issue, cleared the cache file and it was fine.
Seems the module should catch this and deal with it though... if there's a problem reading the cache, just overwrite it.

@jhermann
Copy link

jhermann commented Feb 26, 2018

See also #102 and #83

@fdemmer
Copy link
Contributor

fdemmer commented May 6, 2019

If it's possible to run the script again, you could try to remove old cache file (or rename it).

running again alone, does not work/help, since the redis backend reads the response and timestamp at once (https://github.com/reclosedev/requests-cache/blob/master/requests_cache/core.py#L103) before the expiration code can run.

deleting the cache seems to be the only workaround :(

at least with the redis backend, it would be better to have keys expire by themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants