Answer the question
In order to leave comments, you need to log in
How to activate Kuna Code via API?
The essence of the problem is that through the api I am trying to activate the so-called Kuna Code, which activates the translation,
import requests
import time
import hmac
import hashlib
secret_key = '' # здесь все указываем
public_key = '' # здесь все указываем
url = "https://api.kuna.io/v3/auth/kuna_codes/redeem"
api_path = "/v3/auth/kuna_codes/redeem"
rs = 'https://api.kuna.io/v3/auth/me'
api_paths = "/v3/auth/me"
body = ''
nonce = str(int(time.time()*1000.0))
body = str('')
msg = api_paths+nonce+body
print(msg)
kun_signature = hmac.new(secret_key.encode('ascii'), msg.encode('ascii'), hashlib.sha384).hexdigest()
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
'kun-nonce': nonce,
'kun-apikey': public_key,
'kun-signature': kun_signature
}
pool = requests.post(rs, headers=headers)
print(pool.text)
codein = {"code": ""}
response = requests.request("PUT", url, json=codein, headers=headers) #активация кода
print(response.text)
{"messages":["the_tonce_has_already_been_used_by_access_key"]}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question