votes up 4

No connection adapters were found for (!r)

Exception Class:

Raise code

        for (prefix, adapter) in self.adapters.items():

            if url.lower().startswith(prefix.lower()):
                return adapter

        # Nothing matches :-/
        raise InvalidSchema("No connection adapters were found for {!r}".format(url))

    def close(self):
        """Closes all adapters and as such the session"""
        for v in self.adapters.values():

    def mount(self, prefix, adapter):

Comment explaining raise

Nothing matches :-/

😲  Walkingbet is Android app that pays you real bitcoins for a walking. Withdrawable real money bonus is available now, hurry up! 🚶

Ways to fix

votes up 1 votes down

Dec 30, 2021 zaytcev1976 answer
votes up 0 votes down

Steps to reproduce:

Step 1: Create a new directory using the command

$ mkdir test-requests

Step 2: Navigate to that directory using the command

$ cd test-requests

Step 3: Run the following command

$ pipenv shell

Step 4: Install the dependencies in a virtual environment using the command

$ pipenv install requests

Step 5: Run the following code to reproduce the exception

import requests

requests.get("''") # notice the incorrect use of quotes

The above code generates the following exception:

InvalidSchema                             Traceback (most recent call last)
<ipython-input-53-71a1cbef6f17> in <module>()
      1 import requests
----> 3 requests.get("''")

/usr/local/lib/python3.7/dist-packages/requests/ in get_adapter(self, url)
    727         # Nothing matches :-/
--> 728         raise InvalidSchema("No connection adapters were found for {!r}".format(url))
    730     def close(self):

InvalidSchema: No connection adapters were found for "''"

Fixed version of code:

import requests

Jun 18, 2021 umangtaneja98 answer

Add a possible fix

Please authorize to post fix