(self, url, params={})
| 939 | self.spawn(self.pong, client, message) |
| 940 | |
| 941 | async def authenticate(self, url, params={}): |
| 942 | self.check_required_credentials() |
| 943 | messageHash = 'authenticated' |
| 944 | client = self.client(url) |
| 945 | future = self.safe_value(client.subscriptions, messageHash) |
| 946 | if future is None: |
| 947 | timestamp = str(self.milliseconds()) |
| 948 | urlParts = url.split('/') |
| 949 | partsLength = len(urlParts) |
| 950 | path = self.safe_string(urlParts, partsLength - 1) |
| 951 | version = self.safe_string(urlParts, partsLength - 2) |
| 952 | auth = timestamp + '+' + version + '/' + path |
| 953 | secret = self.base64_to_binary(self.secret) |
| 954 | signature = self.hmac(self.encode(auth), secret, hashlib.sha256, 'base64') |
| 955 | request = { |
| 956 | 'op': 'auth', |
| 957 | 'id': str(self.nonce()), |
| 958 | 't': timestamp, |
| 959 | 'key': self.apiKey, |
| 960 | 'sig': signature, |
| 961 | } |
| 962 | future = await self.watch(url, messageHash, self.extend(request, params), messageHash) |
| 963 | client.subscriptions[messageHash] = future |
| 964 | return future |
no test coverage detected