def __create_request_by_get(self, url, builder): request = RestApiRequest() request.method = "GET" request.host = self.__server_url request.header.update({'Content-Type': 'application/json'}) request.url = url + "?" + builder.build_url() return request
def __create_request_by_get_with_apikey(self, url, builder): request = RestApiRequest() request.method = "GET" request.host = self.__server_url request.header.update({'Content-Type': 'application/json'}) request.header.update({"X-MBX-APIKEY": self.__api_key}) request.url = url + "?" + builder.build_url() PrintMix.print_data(request) return request
def __create_request_by_put_with_signature(self, url, builder): request = RestApiRequest() request.method = "PUT" request.host = self.__server_url builder.put_url("recvWindow", 60000) builder.put_url("timestamp", str(get_current_timestamp() - 1000)) create_signature(self.__secret_key, builder) request.header.update({'Content-Type': 'application/json'}) request.header.update({"X-MBX-APIKEY": self.__api_key}) request.url = url + "?" + builder.build_url() PrintMix.print_data(request) return request
def __create_request_by_get_with_signature(self, url, builder): request = RestApiRequest() request.method = "GET" request.host = self.__server_url builder.put_url("recvWindow", 60000) builder.put_url("timestamp", str(get_current_timestamp() - 1000)) create_signature(self.__secret_key, builder) request.header.update( {"Content-Type": "application/x-www-form-urlencoded"}) request.header.update({"X-MBX-APIKEY": self.__api_key}) request.url = url + "?" + builder.build_url() self.logger.debug(PrintMix.print_data(request)) return request