本帖最后由 gangl12345 于 2020-7-22 12:13 编辑
在学习使用request.get方法的时候,传递代理IP的参数,一直返回301错误,代码如下,有哪位老师帮忙看下?:
import requests
proxies = {
"http": "http://124.90.140.17:16649",
"https": "https://124.90.140.17:16649"
}
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}
response = requests.get('http://httpbin.org/get', headers=headers, proxies=proxies)
print(type(response))
print(response.status_code)
print(type(response.text))
print(response.text)
返回如下:OSError: Tunnel connection failed: 301 Moved Permanently
|
|