Closed EntilZha closed 9 years ago
Hi @EntilZha
I have tested urllib3.util.url.parse_url
and urllib3.util.parse_url
in ipython of python v2 and python v3, and both methods work fine.
>>> urllib3.util.url.parse_url("http://www.google.com")
Url(scheme='http', auth=None, host='www.google.com', port=None, path=None, query=None, fragment=None)
>>> urllib3.util.parse_url("http://www.google.com")
Url(scheme='http', auth=None, host='www.google.com', port=None, path=None, query=None, fragment=None)
In fact, they are the same method as they have the same memory address:
>>> urllib3.util.url.parse_url
<function parse_url at 0x1057301e0>
>>> urllib3.util.parse_url
<function parse_url at 0x1057301e0>
You also can look into the source code of urllib3: https://github.com/shazow/urllib3/blob/master/urllib3/util/url.py#L121 https://github.com/shazow/urllib3/blob/master/urllib3/util/__init__.py#L21
What might explain the error? I was using this within a docker environment so the installations are from latest pypi release. My guess is that somewhere I have a version discrepancy.
I think I know what happened. When I ran tests locally, it was using my older 1.7.1
version of urllib3 on my local machine. On docker it was using a newer version, but by the time I ran the tests there, I already had changed the call to urllib3.util.parse_url
so didn't see that either would work in the newest version.
My proposal would be to keep urllib3.util.parse_url
since it is better for backwards compatibility (seems like the url
package was added to organize repo), but in any case my problem would be fixed by upgrading.
Thanks @EntilZha , I will change urllib3.util.url.parse_url
to urllib3.util.parse_url
for backwards compatibility, and would be better you can upgrade your urllib3
.
I am writing some code which uses the generated code libraries and am running into a stack trace that looks like this (on develop_2.0, not using 2.1.3 since it doesn't include the patch for incorrect directory):
Basically the problem is that the code has this call:
urllib3.util.url.parse_url
It should be:
urllib3.util.parse_url
On a different note, this and a couple other bugs I have found (like the incorrect directory name) point to that Python code generation seems second class and not well maintained. How trustworthy can I be of the code to be correct? I am using it in a production system so would like to get a feeling for that, and if it is not super well maintained, are there some low hanging fruit to help out with?