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_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() # For develop self.develop_flag(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() 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() PrintMix.print_data(request) return request
def __create_request_by_delete_with_signature(self, url, builder): request = RestApiRequest() request.method = "DELETE" 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() # For develop self.develop_flag(request) return request
def __create_request_by_delete_with_signature(self, url, builder): request = RestApiRequest() request.method = "DELETE" 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() # # For develop # print("====== Request ======") # print(request) # PrintMix.print_data(request) # print("=====================") return request
def __create_request_by_post_with_signature(self, url, builder): request = RestApiRequest() request.method = "POST" 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.post_body = builder.post_map request.url = url + "?" + builder.build_url() # For develop print("====== Request ======") print(request) PrintMix.print_data(request) print("=====================") return request