asterisk / ari-py

Library for accessing the Asterisk REST Interface
Other
151 stars 106 forks source link

urlparse lib for python 3 #17

Open straticsryan opened 9 years ago

straticsryan commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 1 year ago

Any updates getting this working on python3 ?