Czy ktoś może wie w jaki sposób powinienem się do niego podłączyć?
Poniżej kod jakim próbuję to zrobić - zwraca błąd 404.
Będę wdzięczny za wskazówki.
Pozdrawiam
Kod: Zaznacz cały
class Coins(AuthBase):
def __init__(self, api_key, secret_key):
self.api_key = api_key
self.secret_key = secret_key
def __call__(self, request):
timestamp = str(int(time.time()))
message = request.body.decode()
hmac_key = self.secret_key.encode('utf-8')
signature = hmac.new(hmac_key, message.encode('utf-8'), hashlib.sha512)
signature_base64 = signature.hexdigest()
request.headers.update({
'API-Key': self.api_key,
'API-Hash': signature_base64,
})
return request
api_url = 'https://bitbay.net/API/Trading/tradingApi.php'
API_KEY =
API_SECRET =
auth = Coins(API_KEY, API_SECRET)
order = {
'method':'orders',
'moment':int(time.time())
}
r = requests.post(api_url,json=order,auth=auth )
EDIT:
Znalazłem rozwiązanie więc podsyłam na przyszłość:
Kod: Zaznacz cały
class Coins(AuthBase):
def __init__(self, api_key, secret_key):
self.api_key = api_key
self.secret_key = secret_key
def __call__(self, request):
message = request.body# decode raw bytes
hmac_key = self.secret_key.encode('utf-8')
signature = hmac.new(hmac_key, message.encode('utf-8'), hashlib.sha512)
signature_base64 = signature.hexdigest()
request.headers.update({
'API-Key': self.api_key,
'API-Hash': signature_base64,
})
return request
api_url = 'https://bitbay.net/API/Trading/tradingApi.php'
API_KEY =
API_SECRET =
auth = Coins(API_KEY, API_SECRET)
data = urllib.parse.urlencode((('method', 'info'),('moment', int(time.time()))))
r = requests.post(api_url,data=data,auth=auth )