python使用代理
前言解决爬虫经常遇到网络被封问题
直接上代码import requests
url = 'https://www.baidu.com'
proxy = {'http': 'http://123.345.456.567:8080', 'https': 'http://123.345.456.567:8080'}
res = requests.get(url=url, proxies=proxy)
假如电脑开启了v2xxx代理,代理则为
{'http': 'http://127.0.0.1:10809', 'https': 'http://127.0.0.1:10809'}
比如我这里就是10809
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)