sendsms.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:awesome-hacking-via-python 作者: shashi12533 项目源码 文件源码
def login(uname,passwd):
    global logging
    global o
    global confget
    global filecookiejar
    logging.debug("Logging using url: %s" % confget('Auth','logincheck'))
    login_encode=urllib.urlencode({'MobileNoLogin':uname, 'LoginPassword':passwd})
    logging.debug("login_encode:%s" % login_encode)
    cookieprocessor=urllib2.HTTPCookieProcessor() #new cookie processor
    o = urllib2.build_opener(cookieprocessor) # a new urlopener
    f = tryopen(o,confget('Auth','logincheck'),login_encode)
    logging.debug("Sent Login information, got the following return URL: %s", f.geturl())
    if f.read().find(confget('Auth','logindone')) != -1:
        #save cookies
        cj=cookieprocessor.cookiejar
        cookie=enumerate(cj).next()[1]
        logging.debug("New Cookie:%s:" % cookie)
        filecookiejar.set_cookie(cookie)
        filecookiejar.save(ignore_discard=True)
        logging.debug("Cookies saved in %s" % filecookiejar.filename)
        return True
    else:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号