MissingSchema error via requests: fix pip's help or use "http" by default
See original GitHub issuepip’s help says:
–proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
But when leaving out the scheme, requests
complains:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 194, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_page
session=self.session,
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 670, in get_page
resp = session.get(url, headers={"Accept": "text/html"})
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 395, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 383, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 486, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 305, in send
conn = self.get_connection(request.url, proxies)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 206, in get_connection
except_on_missing_scheme(proxy)
File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 631, in except_on_missing_scheme
raise MissingSchema('Proxy URLs must have explicit schemes.')
MissingSchema: Proxy URLs must have explicit schemes.
I could imagine fixing the help, or making pip default to using the http
scheme.
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
How to solve MissingSchema error in python/ Beautiful Soup?
You can use this example how to load the images from bing into PIL object: import requests from PIL import Image from io...
Read more >requests 2.17.1 - PyPI
Fixed issue where non-UTF8 reason phrases got severely mangled by falling back to decoding using ISO 8859-1 instead. Fixed a bug where Requests...
Read more >Requests Documentation - Read the Docs
Requests is an elegant and simple HTTP library for Python, ... By default, requests does not support this, but there is a separate...
Read more >MissingSchema: Invalid URL ' ': No schema supplied
Solved: Using Python 3.6.9, I'm making requests with Requests by calling URLs from a text file. I put five of them here, for...
Read more >Invalid URL 'None': No schema supplied. Perhaps you meant ...
MissingSchema : Invalid URL 'None': No schema supplied. ... I had a typo in my eikon.cfg file using a string in my cfg...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, just tested it: the exception has changed at least… 😉
When looking into requests it seemed like the scheme/protocol would not be necessary anymore (https://github.com/kennethreitz/requests/pull/2219), but this appears to be a problem in the code above.
It works without the trailing slash:
btw: I have created https://github.com/kennethreitz/requests/issues/2220 which would allow for pip to specify a proxy explicitly.
So basically this is just a corner case issue with requests probably, where it fails to prepend the default scheme for
HOST:PORT/
.This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.