Skip to content
New issue

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

{"code":-1100,"msg":"Illegal characters found in a parameter."} #104

Open
RRainbowCodeRR opened this issue Jul 9, 2022 · 1 comment
Open

Comments

@RRainbowCodeRR
Copy link

RRainbowCodeRR commented Jul 9, 2022

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."}

@PengRusty
Copy link

Can you please check if you are using IPv6 address?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants