You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
538 B

# 停止VPN后执行安装动作
# pip install requests pysocks
import requests
# 配置你的SOCKS代理地址和端口
proxy_host = "127.0.0.1"
proxy_port = 1080
# 创建一个Session对象
session = requests.Session()
# 设置代理
session.proxies = {
'http': 'socks5://' + proxy_host + ':' + str(proxy_port),
'https': 'socks5://' + proxy_host + ':' + str(proxy_port)
}
# 使用代理访问网站
response = requests.get('http://www.google.com')
# 打印获取的网页内容
print(response.text)