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