Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python request.post同时使用代理-不工作_Python_Urllib2_Python Requests - Fatal编程技术网

Python request.post同时使用代理-不工作

Python request.post同时使用代理-不工作,python,urllib2,python-requests,Python,Urllib2,Python Requests,我对下面的代码有一个问题,当我试图发布我的登录/pw以访问我想要结束的实际页面时,我用10060超时。然而,如果我对这篇文章发表评论,我确实会得到一个响应,不过这是登录页面,因为很明显,我在尝试访问url而不登录 我在一个diff网络上完成了这项工作,该网络使用相同的负载,不需要无问题的代理。与proxy/post组合有关的东西引起了一个问题,我不确定它是什么 import requests from bs4 import BeautifulSoup url = "https://site/s

我对下面的代码有一个问题,当我试图发布我的登录/pw以访问我想要结束的实际页面时,我用10060超时。然而,如果我对这篇文章发表评论,我确实会得到一个响应,不过这是登录页面,因为很明显,我在尝试访问url而不登录

我在一个diff网络上完成了这项工作,该网络使用相同的负载,不需要无问题的代理。与proxy/post组合有关的东西引起了一个问题,我不确定它是什么

import requests
from bs4 import BeautifulSoup

url = "https://site/stuff_i_want"

payload = {
    'login':'login_name',
    'Password':'pw'
}

proxies={'http': 'http://domain\login:pw@proxy_ip:port',
         'https': 'http://domain\login:pw@proxy_ip:port'
    }

with requests.session() as s:
    p = s.post('https://site/login', data=payload) #w/o post the login page loads, with post I time-out.
    r = s.get(url,proxies=proxies)
    print r.content

你发到网站登录的帖子也需要通过代理吗?我是个白痴。我在帖子中添加了proxies=proxies,它正在发挥作用。我只是想建议哈哈。