BTCTrader / broker-api-docs

The documentation for BTCTrader's white label exchange platform API. Use this documentation to access the APIs of BTCTurk other BTCTrader partners.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authentication Problemi

Bad0 opened this issue · comments

commented

Merhaba, ürettiğim apiKey ve secretKeyi doğru şekilde vermeme, gerekli izinleri vermeme, IP numarasını teyit edip doğru şekilde vermeme, nonce değerini teyit edip doğru şekilde vermeme, ve tüm dökümantasyonu okumama ve aksi yönde bir bilgi görmememe rağmen 401 - Unauthorized hatası alıyorum. CCXT kütüphanesi veya dökümantasyondaki Pyhton kod örnekleri üzerinden denedim, Unauthorized hatasının içeriği yok hangi tür unauthorized olduğu belirsiz.

Denediğim Python kodu:
import time, base64, hmac, hashlib, requests, json

base = "https://api.btcturk.com"
method = "/api/v1/users/balances"
uri = base+method

apiKey = "ZZZ"
apiSecret = "ZZZ"
apiSecret = base64.b64decode(apiSecret)

stamp = str(int(time.time())*1000)
data = "{}{}".format(apiKey, stamp).encode("utf-8")
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
signature = base64.b64encode(signature)
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}

result = requests.get(url=uri, headers=headers)
result.status_code

Denediğim CCXT kodu:

import ccxt
import time
from threading import Thread

BtcturkApiKey = "ZZZ"
BtcturkSecretKey = "ZZZ"

btcturk = ccxt.btcturk()
btcturk.apiKey = BtcturkApiKey
btcturk.secret = BtcturkSecretKey

btcturk.fetch_balance()

merhaba, kodunuzda hata yok gibi gorunuyor. requestleri gonderirken verdiginiz ip'nin ayni oldugundan emin olun. ipv4 adresinizi verdiyseniz ipv6'yi disable ederek deneyin.

commented

Merhaba, evet ipv6'yı bloke ettiğimde çözüldü. Teşekkür ederim. Başkasına lazım olursa ben bu şekilde bloke ettim :
requests.packages.urllib3.util.connection.HAS_IPV6 = False