attachments.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:TnyBot-Discord 作者: 00firestar00 项目源码 文件源码
def url_request(self, url, file_path, proxy_url=None):
        try:
            urllib_request.urlretrieve(url, file_path)
            print(file_path)
        except HTTPError as e:
            print(e.code)
            if proxy_url is not None:
                print("Trying proxy URL")
                url = proxy_url
                await self.url_request(url, file_path)
            else:
                raise e
        except UnicodeEncodeError:
            # Special retry logic for IDN domains
            url = "http://" + url.replace("http://", "").encode("idna").decode("utf-8")
            await self.url_request(url, file_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号