question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

I 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:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
jxrloveyoucommented, May 5, 2022

@hawbox 可以修改库中的URL为‘https://en.volupedia.org/w/api.php’ 就可以调用了 不过响应比较慢。

1reaction
hawboxcommented, Mar 8, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Max retries exceeded with URL in requests - python
Just use requests features: import requests from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry session = requests.
Read more >
PyDSWS ConnectionError - Forum
This raises a connection error: ConnectionError: HTTPConnectionPool(host='product.datastream.com', port=80): Max retries exceeded with url: ...
Read more >
Where's this hosted? : Forums
Where's this hosted? I tried running the TwitterSearch Python library. However I get this error: ConnectionError: HTTPSConnectionPool(host='api.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found