No connection adapters were found for (!r)
Package:
requests
45920

Exception Class:
InvalidSchema
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():
v.close()
def mount(self, prefix, adapter):
Comment explaining raise
Nothing matches :-/
Links to the raise (1)
https://github.com/psf/requests/blob/f6d43b03fbb9a1e75ed63a9aa15738a8fce99b50/requests/sessions.py#L742See also in the other packages (2)
(❌️ No answer)
pipenv/no-connection-adapters-were-found
(❌️ No answer)
pip/no-connection-adapters-were-found-fo
Ways to fix
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("'https://google.com'") # 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
2
----> 3 requests.get("'https://google.com'")
/usr/local/lib/python3.7/dist-packages/requests/sessions.py in get_adapter(self, url)
726
727 # Nothing matches :-/
--> 728 raise InvalidSchema("No connection adapters were found for {!r}".format(url))
729
730 def close(self):
InvalidSchema: No connection adapters were found for "'https://google.com'"
Fixed version of code:
import requests
requests.get("https://google.com")
Add a possible fix
Please authorize to post fix