使用缓存命中的request.get'无法获取属性httpheaderdict'

时间:2019-02-22 02:57:07

标签: python-3.x http-headers python-requests

我在机器A(python3.4.2)上运行了一些代码,下面略作修改:

    querydata = {"format": "json",  "osm_ids":"N107775",'addressdetails':1,'extratags':1,'namedetails':1,'email':'mymail@mail.com'}
    logging.debug('querying {}'.format(querydata))
#    url="https://nominatim.openstreetmap.org/lookup"
    url = 'http://w.x.y.z/nominatim/lookup'
    result = requests.get(url, params=querydata)

在具有请求2.2(以及python 3.4.2)的计算机B上,我不知何故遇到了“ ascii无法编码”错误(什么...我什至...数据全部为ascii ...),现在有了请求2.4.3,我点击了

AttributeError                            Traceback (most recent call last)
<ipython-input-8-54e8fb89066a> in <module>()
....
---> 12 result = requests.get(url, params=querydata)
....
/usr/local/lib/python3.4/dist-packages/requests_cache/backends/storage/dbdict.py in __getitem__(self, key)
    161 
    162     def __getitem__(self, key):
--> 163         return pickle.loads(bytes(super(DbPickleDict, self).__getitem__(key)))

AttributeError: Can't get attribute 'HTTPHeaderDict' on <module 'urllib3' from '/usr/lib/python3/dist-packages/urllib3/__init__.py'>

我想我可以关闭request_cache来避免这种情况,但是它非常有用。有理论吗?

0 个答案:

没有答案