-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace all urllib / urllib2 imports and uses with requests
#2852
Comments
I'm strongly supportive of switching to requests since it has things like built-in (or easy to add) support for things like retries, timeouts, caching, etc. Having said that, there's so much critical work pending that I'm not sure we can afford to being doing "nice to have" work on existing code that works. Refactoring modules as they get worked on seems fine though. |
Agree. |
possibly unused |
#2894 shows some code smells which need to be avoided when doing any upgrade of this type. If you still have an |
%
|
Thanks, @cclauss for guiding. I'm on it! |
|
This is going to need SEVERAL PRs before it is finally closed. |
grep urlopen **/*.py > files.txt with open("files.txt") as in_file:
files = {line.split(":")[0] for line in in_file}
print("\n".join(sorted(files)))
|
I don't think this script works any more |
Last released in 2004 https://pypi.org/project/PyZ3950 --> http://www.panix.com/~asl2/software/PyZ3950 --> https://github.com/asl2/PyZ3950 (see the PRs) which is far from Python 3 compatible. |
requests
requests
I don't think this file Should |
I went ahead and did a little grepping and such to see that these are all the places urllib is used (excluding infogami). I'm not sure which of these functions we should still try to migrate away from.
|
urllib2
is old, and a bit clunky -- I've found recently it can't do some of things I needed it to do, and it also causes problem for moving to Python3, and generally seems to make the code more complex.Instead of re-using it, and adding new features that use the older mechanisms, can we consider refactoring to use
requests
instead?My PR where I stripped out
urllib2
andStringIO
etc to enableHEAD
requests: #2838a similar PR that went with using
requests
to avoid old bugs: #2779By using
requests
(rather than adding imports fromsix
) we should be getting a better tool for making requests, and reducing code complexity, and the number of imports.Relates to #2308 since a common use of
simplejson
is to parseurllib2
responses.requests
has a builtinjson()
method so an extra import is not required.Describe the problem that you'd like solved
Proposal & Constraints
Additional context
Stakeholders
The text was updated successfully, but these errors were encountered: