ConnectionError: HTTPConnectionPool(host='en.wikipedia.org', port=80): Max retries exceeded with url: /w/api.php?list=search&srprop=&srlimit=10&limit=10&srsearch=Barack&format=json&action=query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000023606F8AB38>: Failed to establish a new connection...
See original GitHub issueI can not use almost any function of wikipidia module. It always returns to me the connection error.
My original code is:
wikipedia.search("Barack")
It gives me the error: `Traceback (most recent call last):
File “<ipython-input-11-04698aa2a856>”, line 1, in <module> wikipedia.search(“Barack”)
File “F:\Anaconda3\anaconda3\lib\site-packages\wikipedia\util.py”, line 28, in call ret = self._cache[key] = self.fn(*args, **kwargs)
File “F:\Anaconda3\anaconda3\lib\site-packages\wikipedia\wikipedia.py”, line 103, in search raw_results = _wiki_request(search_params)
File “F:\Anaconda3\anaconda3\lib\site-packages\wikipedia\wikipedia.py”, line 737, in _wiki_request r = requests.get(API_URL, params=params, headers=headers)
File “F:\Anaconda3\anaconda3\lib\site-packages\requests\api.py”, line 75, in get return request(‘get’, url, params=params, **kwargs)
File “F:\Anaconda3\anaconda3\lib\site-packages\requests\api.py”, line 60, in request return session.request(method=method, url=url, **kwargs)
File “F:\Anaconda3\anaconda3\lib\site-packages\requests\sessions.py”, line 533, in request resp = self.send(prep, **send_kwargs)
File “F:\Anaconda3\anaconda3\lib\site-packages\requests\sessions.py”, line 646, in send r = adapter.send(request, **kwargs)
File “F:\Anaconda3\anaconda3\lib\site-packages\requests\adapters.py”, line 516, in send raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host=‘en.wikipedia.org’, port=80): Max retries exceeded with url: /w/api.php?list=search&srprop=&srlimit=10&limit=10&srsearch=Barack&format=json&action=query (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000023606F8AB38>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。’))`
I am new to scratching data. And I did not find any answer direct for this problem. Do I need to modify any of the scripts in the tracebacks? Appreciate your help!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6

Top Related StackOverflow Question
@hawbox 可以修改库中的URL为‘https://en.volupedia.org/w/api.php’ 就可以调用了 不过响应比较慢。
Hi YixinNJU: I’m from China too and also encountered this problem.This problem is caused by the website block of Wikipedia by Chinese government. So please use proxies to access data from Wikipedia. Second is to degrade the version of urllib3 to 1.25.11 (just use pip install urllib3==1.25.11 to reinstall the module automatically) to avoid ProxyError problem if you are using proxies. The urllib3 bundled with latest Python package added support for HTTPs Proxy however it’s need to make the system preferences configurate well to be working. Unfortunately I still can’t figure out how I can make the preferences to work well with this module also I found an article related to the problem in Chinese for your reference (https://www.cnblogs.com/davyyy/p/14388623.html) . I need somebody to give some solutions to solve this problem. Lastly sorry for my poor English I’m trying to improve that.