Answer the question
In order to leave comments, you need to log in
Why Exmo API authorization error via python requests?
In general, I am writing a client to manage my account on the EXMO exchange. The API is described
here - https://exmo.me/en/api . Reference code is also given there for receiving data via the POST method with authorization via api keys https://github.com/exmo-dev/exmo_api_lib/tree/mast... . But it does not suit me, since the http.client library does not want to work through a proxy, and in general, requests is much more convenient and works with a proxy.
Here is my code piece of code:
def call_api(api_method, **kwargs):
params = {'nonce': int(round(time.time() * 1000))}
if kwargs:
params.update(kwargs)
params = urllib.parse.urlencode(params)
H = hmac.new(key=API_SECRET, digestmod=hashlib.sha512)
H.update(params.encode('utf-8'))
sign = H.hexdigest()
headers = {"Content-type": "application/x-www-form-urlencoded",
"Key": API_KEY,
"Sign": sign}
response = requests.post('https://' + API_URL + "/" + API_VERSION + "/" + api_method,
headers=headers,
params=params
)
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