Pomoc przy API na bitbay

Początkujący
Posty: 3
Rejestracja: 12 grudnia 2017
Reputacja: 0
Reputacja postu: 
0
Napiwki za post: 0 BTC

Pomoc przy API na bitbay

Postautor: brateron » środa, 13 grudnia 2017, 13:59

Mam problem z podłączniem do API na bitbay w Pythonie.

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 )

Wróć do „Boty i strategie”

Kto jest online

Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 6 gości