def __init__(self, api_key=None, secret=None, host=None, proxy_host="", proxy_port=0, timeout=5, try_counts=5):
        self.proxy_host = "127.0.0.1"
        self.proxy_port = 1080
    @property
    def proxies(self):
        if self.proxy_host and self.proxy_port:
            proxy = f"http://{self.proxy_host}:{self.proxy_port}"
            return {"http": proxy, "https": proxy}
        return {}
        for i in range(0, self.try_counts):
            try:
                response = requests.request(req_method.value, url=url, headers=headers, timeout=self.timeout, proxies=self.proxies)
                if response.status_code == 200:
                    return response.json()
                else:
                    print(f"请求没有成功: {response.status_code}, 继续尝试请求")
            except Exception as error:
                print(f"请求:{path}, 发生了错误: {error}, 时间: {datetime.now()}")
                time.sleep(3)

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code