测试场景:出于公司对服务器的安全管理
1、普通代理设置
import requests
proxies = {
"http":"http://127.0.0.1:8888",
"https":"https://127.0.0.1:8888"
}
response = requests.get(url="http:XXX",
proxies=proxies)
print(response.text)
2、加密代理设置
proxies = {
"http":"http://username:password@127.0.0.1:8888",
"https":"https://username:password@127.0.0.1:8888"
}
该篇博客介绍了如何在Python中设置普通和加密代理来访问网络资源。通过示例代码展示了在requests库中配置HTTP和HTTPS代理的方式,确保了服务器的安全管理。

2196

被折叠的 条评论
为什么被折叠?



