MCPcopy Create free account
hub / github.com/ccxt/ccxt / sign

Method sign

python/ccxt/bit2c.py:946–968  ·  view source on GitHub ↗
(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None)

Source from the content-addressed store, hash-verified

944 return self.milliseconds()
945
946 def sign(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None):
947 url = self.urls['api']['rest'] + '/' + self.implode_params(path, params)
948 if api == 'public':
949 url += '.json'
950 else:
951 self.check_required_credentials()
952 nonce = self.nonce()
953 query = self.extend({
954 'nonce': nonce,
955 }, params)
956 auth = self.urlencode(query)
957 if method == 'GET':
958 if query:
959 url += '?' + auth
960 else:
961 body = auth
962 signature = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha512, 'base64')
963 headers = {
964 'Content-Type': 'application/x-www-form-urlencoded',
965 'key': self.apiKey,
966 'sign': signature,
967 }
968 return {'url': url, 'method': method, 'body': body, 'headers': headers}
969
970 def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
971 if response is None:

Callers

nothing calls this directly

Calls 7

nonceMethod · 0.95
implode_paramsMethod · 0.80
extendMethod · 0.45
urlencodeMethod · 0.45
hmacMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected