import json import requests symbol = 'btcusdt' symbol_other = symbol.replace("_", "").replace("-", "").lower() host_list = ["http://43.133.213.20:8001", "http://43.163.230.7:9008"] host = "http://43.163.230.7:9008" headers = {"Accept": "application/json", "Content-Type": "application/json"} url = "/platform/symbol/from_id/start_time/end_time" count = 0 from_id = 5423056100 start_time = None end_time = None platform = 'binance_swap_u' query_param = f"platform={platform}&symbol={symbol_other}&from_id={from_id}&start_time={start_time}&end_time={end_time}" response = requests.request( "GET", host_list[count % 2] + url + "?" + query_param, headers=headers, timeout=10 ) response.json()