使用requests代理ip, proxies中的参数输入http会报错是什么原因?

import requests

url = "http://www.ip181.com/"
proxies = {"https":"175.8.27.130:808",
           "https":"175.8.27.130:999"}

response = requests.get(url,proxies = proxies)
print response.text

上述中,proxies中的参数必须都是"https"开头才能正常访问网站

proxies = {"http":"175.8.27.130:808",
          "https":"175.8.27.130:999"}      会报错



而在访问百度页面时(以下代码部分),proxies中的参数必须都是"http"开头才能正常访问网站

import requests

proxies= {
    "http":"http://175.8.27.130:808",
    "http":"http://175.8.27.130:999"
}
response  = requests.get("https://www.baidu.com",proxies=proxies)
print response.text

proxies = {"http":"175.8.27.130:808",
          "https":"175.8.27.130:999"}      会报错

而将访问百度的代码改成proxies= {"http":"http://175.8.27.130:808"} 单独一条也能正常访问



上述报错内容如下图:


http://img1.mukewang.com/5a9512ab00016e5f11360370.jpg





1.  proxies里的参数  什么时候该填写"http",什么时候该填写"https" ?

2.  为什么       proxies = {"http":"175.8.27.130:808",
                      "https":"175.8.27.130:999"}                 

一个"http",一个"https"会报错?          (我看到网上很多教程都是 一个"http",一个"https")  

LNYIE
浏览 2136回答 0
0回答

慕设计2395807

NFOIXHDTNTZWFBRHDTDCTWBVBHNTDCCJIVUQMPMOOAHDTCVLUOJGOUDBXGCPSXKKHNVNJTWWTGZIYUNCFSLIYKCBOTWPZVLCIOCSEDTJMCKWWGQIYEUQNZMTZWLATAEQNZQMEWCJZYLRHOHJLEKNXWTTPLFIXWSOBEADXVHXHKWJSSMFHKZZEAQTNDCUDVSBRKKCSSRUTPCFZMCLFVYCOLXKJGWIGYRYANPFIYVBZZFSYKXQWGSRHXMMMXDDDKJEXGTJWMWIYKNGWFBEURHEXDTTGSIEBKNPOVGJILFLKSBHHNAGJFSZIRKNGNZTJZJBKCTFIBLZPCHQZWUQMPMAGXGTCEQNTTPZGYGGJMSFLBRNPYVIUXUQGWEGWZZLXNQDQHTPMYLRBXBASIRBHNZJCIQBHWEOHQNMJZIEAQATGSYOOBXOUEQWTORRBTOOKQWQLSZNMP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