我无法登录网站[urllib,urllib2]

时间:2015-02-17 02:25:14

标签: python python-2.7 login urllib2 urllib

网站:https://login.metu.edu.tr/cas/login

我的代码:

   cj = cookielib.CookieJar()
   opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
   opener.addheaders = [('User-agent', 'Mozilla/5.0')]
   urllib2.install_opener(opener)
   authentication_url = 'https://login.metu.edu.tr/cas/login'
   payload = {
      'username':username,
      'password':password,
      'lt':'A', # this is changing
      'execution':'e4s1',
      '_eventId':'submit'
            }
   data = urllib.urlencode(payload)
   req = urllib2.Request(authentication_url, data)
   resp = urllib2.urlopen(req)

没有错误。只是,我无法登录。问题是什么 ?有什么遗漏?

0 个答案:

没有答案