遇到HTTP错误400:在python中使用mechanize时请求错误

遇到HTTP错误400:在python中使用mechanize时请求错误,python,cookies,mechanize,bad-request,cookiejar,Python,Cookies,Mechanize,Bad Request,Cookiejar,我在Python中使用mechanize时遇到了一个问题,请先查看我的代码: >>> s 'http://www.renren.com' >>> br=mechanize.Browser() >>> br.open(s) <response_seek_wrapper at 0x1012b15f0 whose wrapped object = <closeable_response at 0x1012b11b8 whose fp =

我在Python中使用mechanize时遇到了一个问题,请先查看我的代码:

>>> s
'http://www.renren.com'
>>> br=mechanize.Browser()
>>> br.open(s)
<response_seek_wrapper at 0x1012b15f0 whose wrapped object = <closeable_response at 0x1012b11b8 whose fp = <socket._fileobject object at 0x1012949d0>>>
>>> br.set_cookiejar(cj)
>>> br.open(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 203, in open
  File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 255, in _mech_open
mechanize._response.httperror_seek_wrapper: HTTP Error 400: Bad Request
>>s
'http://www.renren.com'
>>>br=mechanize.Browser()
>>>br.开放式(s)
>>>br.set_cookiejar(cj)
>>>br.开放式(s)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py”,第203行,打开
文件“build/bdist.macosx-10.7-intel/egg/mechanize/\u mechanize.py”,第255行,在“打开”中
mechanize.\u response.httperror\u seek\u包装器:HTTP错误400:错误请求
变量“s”的值是我想访问的网站的url,然后我创建了一个Browser(),然后执行br.open(s),这里没有错误,但是在我给“br”分配了一个cookiejar之后,继续调用参数正确的open()方法,出现错误,显示“请求错误”


我该怎么办?非常感谢

尝试在浏览器中复制此内容。当涉及到cookies时,该网站似乎有一定的要求。该站点不喜欢您添加的cookie,因此以400错误阻止您。

尝试在浏览器中复制此错误。当涉及到cookies时,该网站似乎有一定的要求。该站点不喜欢您添加的cookies,因此以400错误阻止您