BitMEX / api-connectors

Libraries for connecting to the BitMEX API.
https://www.bitmex.com/app/restAPI
910 stars 795 forks source link

Python 2 `ImportError: No module named parse` #69

Closed scopelf closed 6 years ago

scopelf commented 6 years ago

Please update the imports in /BitMEXAPIKeyAuthenticator.py and change line 57 to parsedURL = urlparse(url) to assure that there is no ImportError: No module named parse when importing bitmex in python 2. The following code works for python 2 and 3.

try:
    from urllib.parse import urlparse
except ImportError:
     from urlparse import urlparse

For a problem description see: Stackoverflow

Or since you are using six:

from six.moves.urllib.parse import urlparse
ryanfox commented 6 years ago

Python 2 is not going to be supported going forward.