Skip to content
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

urlparse lib for python 3 #17

Open
straticsryan opened this issue Jul 11, 2015 · 3 comments
Open

urlparse lib for python 3 #17

straticsryan opened this issue Jul 11, 2015 · 3 comments

Comments

@straticsryan
Copy link

in python 3, urlparse has been renamed to urllib.parse (https://docs.python.org/2/library/urlparse.html).

you can use the following code to try python2's name and on error try python3's name.

try:
    import urlparse
except ImportError:
    import urllib.parse as urlparse
@straticsryan
Copy link
Author

To note, this also needs to happen in swagger py or else you'll get an error saying you can't find swagger_model or something.

@straticsryan
Copy link
Author

alternatively, you can do this as well:

import sys
if sys.version_info < (3, 0):
    import urllib
    import urlparse
else:
    import urllib.request as urllib
    import urllib.parse as urlparse

@rapidarchitect
Copy link

Any updates getting this working on python3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants