Python mechanize.\u response.httperror\u seek\u包装器:HTTP错误403:确定

Python mechanize.\u response.httperror\u seek\u包装器:HTTP错误403:确定,python,login,mechanize,http-status-code-403,login-script,Python,Login,Mechanize,Http Status Code 403,Login Script,我多次尝试的内容: 1.更改标题以欺骗它是行不通的 2.在表格nr=0、nr=1和nr=2上试用过也不起作用 3.确认的用户名和密码正确 4.同样的脚本也适用于其他类似的网站 所有尝试都将返回错误: mechanize.\u response.httperror\u seek\u包装器:HTTP错误403:确定 关于stackoverflow的其他现有问题可能有403:禁止和403:robots.txt禁止两种情况,但实际上没有“OK”这种独特的情况 结果: br.submit()

我多次尝试的内容:
1.更改标题以欺骗它是行不通的
2.在表格
nr=0
nr=1
nr=2
上试用过也不起作用
3.确认的用户名和密码正确
4.同样的脚本也适用于其他类似的网站

所有尝试都将返回错误:

mechanize.\u response.httperror\u seek\u包装器:HTTP错误403:确定

关于stackoverflow的其他现有问题可能有
403:禁止
403:robots.txt禁止
两种情况,但实际上没有“OK”这种独特的情况

结果:

    br.submit()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mechanize/_mechanize.py", line 541, in submit
    return self.open(self.click(*args, **kwds))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mechanize/_mechanize.py", line 203, in open
    return self._mech_open(url, data, timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mechanize/_mechanize.py", line 255, in _mech_open
    raise response
mechanize._response.httperror_seek_wrapper: HTTP Error 403: OK

您收到一个HTTP错误403,表示身份验证错误。 虽然这不是一个407代理身份验证错误,但它可能意味着机械化的代理身份验证问题

您是否在代理后工作?如果是这样,您应该考虑将~/.BasHyPrror或~/.Prras设置为;p>
export {http_proxy,https_proxy,ftp_proxy}=http://<username>:<pass>@<proxy_address>:<port>
export{http\u proxy,https\u proxy,ftp\u proxy}=http://:@:
如果已经设置了代理,如果通过crontab运行脚本,也可能会出现此错误。如果是这样,您应该在crontab中将代理设置设置为

http_proxy=http://<username>:<pass>@<proxy_address>:<port>
https_proxy=https://<username>:<pass>@<proxy_address>:<port>
http_proxy=http://:@:
https_proxy=https://:@:
我希望这能奏效

http_proxy=http://<username>:<pass>@<proxy_address>:<port>
https_proxy=https://<username>:<pass>@<proxy_address>:<port>