312

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?

3 Answers 3

571

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.

0
43

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
3
  • 15
    Or if your url is accidentally a tuple because of a trailing comma url = self.base_url % endpoint, Sep 22, 2017 at 15:44
  • @ChristianLong is there any way to convert a string to proper url? Like, can you tell me, what are you doing in your comment? Aug 11, 2018 at 11:50
  • for me it was the ` " "` not sure why, but at some point my single-quoted URL became single-quoted and then double-quoted (maybe pyCharm, maybe github, at some point it must got filtered that way. I had "google.com" and then it became " ' google.com ' " - after making it just a string it worked again. Jun 9, 2021 at 14:58
-6

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.