Skip to content

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

@RRainbowCodeRR

Description

@RRainbowCodeRR

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions