Python Requests - No connection adapters

PythonPython 2.7Python Requests

Python Problem Overview


I'm using the Requests: HTTP for Humans library and I got this weird error and I don't know what is mean.

No connection adapters were found for '192.168.1.61:8080/api/call'

Anybody has an idea?

Python Solutions


Solution 1 - Python

You need to include the protocol scheme:

'http://192.168.1.61:8080/api/call'

Without the http:// part, requests has no idea how to connect to the remote server.

Note that the protocol scheme must be all lowercase; if your URL starts with HTTP:// for example, it won’t find the http:// connection adapter either.

Solution 2 - Python

One more reason, maybe your url include some hiden characters, such as '\n'.

If you define your url like below, this exception will raise:

url = '''
http://google.com
'''

because there are '\n' hide in the string. The url in fact become:

\nhttp://google.com\n

Solution 3 - Python

Fix connection adapter matching to be most-specific first,Miscellaneous small Python 3 text encoding bugs.,.netrc no longer overrides explicit auth.,Mountable Connection Adapters

To install Requests, simply:

$ pip install requests

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAzd325View Question on Stackoverflow
Solution 1 - PythonMartijn PietersView Answer on Stackoverflow
Solution 2 - PythonKingnameView Answer on Stackoverflow
Solution 3 - PythonPriyabrata SamantarayView Answer on Stackoverflow