import mechanize
import http.cookiejar as cookielib
br = mechanize.Browser()
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open('https://vortex.gg/account/signin')
br._factory.is_html = True
br.select_form(nr=0)
br.form['Username'] = '***************'
br.form['Password'] = '***************'
#i am not sure about this proxy
br.set_proxies({"http":'104.238.176.152:8080'})
r = br.submit()
html = r.read()
#i wanna see html code after autentification
f = open('source_vox.html', 'w')
f.write(html)
f.close
*追溯(最近一次通话):在第19行的文件“ test_vox.py”中br.open('https://vortex.gg/account/signin')打开文件“ /usr/lib/python2.7/dist-packages/mechanize/_mechanize.py”,第253行返回self._mech_open(url_or_request,data,timeout = timeout)_mech_open中的文件“ /usr/lib/python2.7/dist-packages/mechanize/_mechanize.py”,第309行引起回应mechanize._response.httperror_seek_wrapper:HTTP错误403:禁止*