Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

initUrllib()代理上网 #59

Open
plybb opened this issue Feb 6, 2020 · 5 comments
Open

initUrllib()代理上网 #59

plybb opened this issue Feb 6, 2020 · 5 comments
Labels
question Further information is requested

Comments

@plybb
Copy link

plybb commented Feb 6, 2020

如果使用代理上网,在utils.py自行修改initUrllib()的参数。
修改哪一行参数呢?请示范一下,谢谢Up

@kajweb
Copy link
Owner

kajweb commented Feb 6, 2020

请提供代理接口给我测试

@lovejun277
Copy link

lovejun277 commented Feb 6, 2020 via email

@plybb
Copy link
Author

plybb commented Feb 7, 2020

请提供代理接口给我测试

就是普通代理服务器,格式为,地址:端口
initUrllib()的参数中没有找到关于proxy的语句,所以不知道怎么配置

@kajweb
Copy link
Owner

kajweb commented Feb 7, 2020

参考urllib、的文档
按照https://www.liaoxuefeng.com中说的是

proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example.com:3128/'})
proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()
proxy_auth_handler.add_password('realm', 'host', 'username', 'password')
opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)
with opener.open('http://www.example.com/login.html') as f:
    pass

使用 urllib 设置代理服务

或者使用CCProxy等软件进行本地代理。

@kajweb kajweb added the question Further information is requested label Feb 7, 2020
@plybb
Copy link
Author

plybb commented Feb 7, 2020

@kajweb
多谢Up,我去测试

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants