mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 01:55:18 +08:00
BUG: fixed issue #64 with SSL certificates
This commit is contained in:
@@ -3,11 +3,12 @@ import json
|
||||
import time
|
||||
import hmac
|
||||
import hashlib
|
||||
|
||||
import ssl
|
||||
|
||||
# Workaround for backwards compatibility
|
||||
# https://stackoverflow.com/questions/3745771/urllib-request-in-python-2-7
|
||||
from six.moves import urllib
|
||||
|
||||
urlopen = urllib.request.urlopen
|
||||
|
||||
|
||||
@@ -48,7 +49,8 @@ class Bittrex_api(object):
|
||||
headers = {}
|
||||
|
||||
req = urllib.request.Request(url, headers=headers)
|
||||
response = json.loads(urlopen(req).read())
|
||||
response = json.loads(urlopen(
|
||||
req, context=ssl._create_unverified_context()).read())
|
||||
|
||||
if response["result"]:
|
||||
return response["result"]
|
||||
|
||||
@@ -3,6 +3,7 @@ import json
|
||||
import time
|
||||
import hmac
|
||||
import hashlib
|
||||
import ssl
|
||||
|
||||
from six.moves import urllib
|
||||
|
||||
@@ -104,9 +105,10 @@ class Poloniex_api(object):
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=post_data,
|
||||
headers=headers
|
||||
headers=headers,
|
||||
)
|
||||
return json.loads(urlopen(req).read())
|
||||
return json.loads(
|
||||
urlopen(req, context=ssl._create_unverified_context()).read())
|
||||
|
||||
def returnticker(self):
|
||||
return self.query('returnTicker', {})
|
||||
|
||||
Reference in New Issue
Block a user