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

Method sign

python/ccxt/async_support/bitflyer.py:1155–1180  ·  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

1153 }
1154
1155 def sign(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None):
1156 request = '/' + self.version + '/'
1157 if api == 'private':
1158 request += 'me/'
1159 request += path
1160 if method == 'GET':
1161 if params:
1162 request += '?' + self.urlencode(params)
1163 baseUrl = self.implode_hostname(self.urls['api']['rest'])
1164 url = baseUrl + request
1165 if api == 'private':
1166 self.check_required_credentials()
1167 nonce = str(self.nonce())
1168 content = [nonce, method, request]
1169 auth = ''.join(content)
1170 if params:
1171 if method != 'GET':
1172 body = self.json(params)
1173 auth += body
1174 headers = {
1175 'ACCESS-KEY': self.apiKey,
1176 'ACCESS-TIMESTAMP': nonce,
1177 'ACCESS-SIGN': self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256),
1178 'Content-Type': 'application/json',
1179 }
1180 return {'url': url, 'method': method, 'body': body, 'headers': headers}
1181
1182 def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1183 if response is None:

Callers

nothing calls this directly

Calls 7

implode_hostnameMethod · 0.80
urlencodeMethod · 0.45
nonceMethod · 0.45
jsonMethod · 0.45
hmacMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected