(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None)
| 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: |
nothing calls this directly
no test coverage detected