Skip to content
This repository was archived by the owner on Oct 9, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cryptsy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import urllib
import urllib2
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import json
import time
import hmac
Expand All @@ -18,14 +18,14 @@ def _public_api_query(self, method, marketid=None):
if marketid is not None:
request_url += '&marketid=%d' % marketid

rv = urllib2.urlopen(urllib2.Request(request_url))
rv = urllib.request.urlopen(urllib.request.Request(request_url))
return json.loads(rv.read())

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

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

rv = urllib2.urlopen(urllib2.Request('https://www.cryptsy.com/api',
rv = urllib.request.urlopen(urllib.request.Request('https://www.cryptsy.com/api',
post_data,
headers))

Expand Down
2 changes: 1 addition & 1 deletion test_cryptsy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import urllib2
import urllib.request, urllib.error, urllib.parse

from mock import Mock

Expand Down