async def rest_authenticate(self, request: RESTRequest) -> RESTRequest: if request.method == RESTMethod.POST: request.data = self.add_auth_to_params(request.data) else: request.params = self.add_auth_to_params(request.params) request.headers = {"X-MBX-APIKEY": self._api_key} return request
async def rest_authenticate(self, request: RESTRequest) -> RESTRequest: """ Adds the server time and the signature to the request, required for authenticated interactions. It also adds the required parameter in the request header. :param request: the request to be configured for authenticated interaction """ request.params = self.add_auth_to_params(params=request.params) headers = {} if request.headers is not None: headers.update(request.headers) request.headers = headers return request
async def rest_authenticate(self, request: RESTRequest) -> RESTRequest: request_params = self.add_auth_to_params(params=request.params) if request.method == RESTMethod.POST: request.data = payload.JsonPayload(dict(request_params), dumps=ujson.dumps) request.params = None else: request.params = request_params headers = {} if request.headers is not None: headers.update(request.headers) endpoint = str(urlsplit(request.url).path) signature = self._generate_signature(method=request.method.name, endpoint=endpoint, params=request_params) headers.update(self.header_for_authentication(signature)) request.headers = headers return request
async def rest_authenticate(self, request: RESTRequest) -> RESTRequest: """ Adds the server time and the signature to the request, required for authenticated interactions. It also adds the required parameter in the request header. :param request: the request to be configured for authenticated interaction """ if request.method == RESTMethod.POST: request.data = self.add_auth_to_params( params=json.loads(request.data)) else: request.params = self.add_auth_to_params(params=request.params) headers = {} if request.headers is not None: headers.update(request.headers) headers.update(self.header_for_authentication()) request.headers = headers return request