Skip to content

Commit 63f0f62

Browse files
committed
Convert to Python3
1 parent aa1ef82 commit 63f0f62

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Cryptsy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import urllib
2-
import urllib2
1+
import urllib.request, urllib.parse, urllib.error
2+
import urllib.request, urllib.error, urllib.parse
33
import json
44
import time
55
import hmac
@@ -18,14 +18,14 @@ def _public_api_query(self, method, marketid=None):
1818
if marketid is not None:
1919
request_url += '&marketid=%d' % marketid
2020

21-
rv = urllib2.urlopen(urllib2.Request(request_url))
21+
rv = urllib.request.urlopen(urllib.request.Request(request_url))
2222
return json.loads(rv.read())
2323

2424
def _api_query(self, method, request_data={}):
2525
""" Call to the "private" api and return the loaded json. """
2626
request_data['method'] = method
2727
request_data['nonce'] = int(round(time.time() * 1000))
28-
post_data = urllib.urlencode(request_data)
28+
post_data = urllib.parse.urlencode(request_data)
2929

3030
signed_data = hmac.new(self.SECRET, post_data, hashlib.sha512)\
3131
.hexdigest()
@@ -34,7 +34,7 @@ def _api_query(self, method, request_data={}):
3434
'Key': self.API_KEY
3535
}
3636

37-
rv = urllib2.urlopen(urllib2.Request('https://www.cryptsy.com/api',
37+
rv = urllib.request.urlopen(urllib.request.Request('https://www.cryptsy.com/api',
3838
post_data,
3939
headers))
4040

test_cryptsy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
import urllib2
2+
import urllib.request, urllib.error, urllib.parse
33

44
from mock import Mock
55

0 commit comments

Comments
 (0)