We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As per (https://docs.binance.us/?python#get-server-time) I am testing this here code for the API.
import urllib.parse import hashlib import hmac import base64 import requests import time
api_url = "https://api.binance.us"
def get_binanceus_signature(data, secret): postdata = urllib.parse.urlencode(data) message = postdata.encode() byte_key = bytes(secret, 'UTF-8') mac = hmac.new(byte_key, message, hashlib.sha256).hexdigest() return mac
def binanceus_request(uri_path, data, api_key, api_sec): headers = {} headers['X-MBX-APIKEY'] = api_key signature = get_binanceus_signature(data, api_sec) params={ **data, "signature": signature, } req = requests.get((api_url + uri_path), params=params, headers=headers) return req.text
api_key='my_key' secret_key='my_secret'
uri_path = "/sapi/v1/system/status" data = { "timestamp": int(round(time.time() * 1000)), }
result = binanceus_request(uri_path, data, api_key, secret_key) print("GET {}: {}".format(uri_path, result))
But I keep receiving this error when I run the code. GET /sapi/v1/system/status: {"code":-1100,"msg":"Illegal characters found in a parameter."}
The text was updated successfully, but these errors were encountered:
Can you please check if you are using IPv6 address?
Sorry, something went wrong.
No branches or pull requests
As per (https://docs.binance.us/?python#get-server-time) I am testing this here code for the API.
import urllib.parse
import hashlib
import hmac
import base64
import requests
import time
api_url = "https://api.binance.us"
def get_binanceus_signature(data, secret):
postdata = urllib.parse.urlencode(data)
message = postdata.encode()
byte_key = bytes(secret, 'UTF-8')
mac = hmac.new(byte_key, message, hashlib.sha256).hexdigest()
return mac
def binanceus_request(uri_path, data, api_key, api_sec):
headers = {}
headers['X-MBX-APIKEY'] = api_key
signature = get_binanceus_signature(data, api_sec)
params={
**data,
"signature": signature,
}
req = requests.get((api_url + uri_path), params=params, headers=headers)
return req.text
api_key='my_key'
secret_key='my_secret'
uri_path = "/sapi/v1/system/status"
data = {
"timestamp": int(round(time.time() * 1000)),
}
result = binanceus_request(uri_path, data, api_key, secret_key)
print("GET {}: {}".format(uri_path, result))
But I keep receiving this error when I run the code.
GET /sapi/v1/system/status: {"code":-1100,"msg":"Illegal characters found in a parameter."}
The text was updated successfully, but these errors were encountered: