Exemplo n.º 1
0
 def parser_cookie_file(self, replace=(".com", ".fm")):
     cookie_file = utils.get_cookie_file(self.username)
     if os.path.exists(cookie_file):
         with open(cookie_file, "rw+") as fp:
             new_line = None
             for line in fp:
                 if line.startswith("#HttpOnly_.douban"):
                     new_line = line.replace(replace[0], replace[1])
                     break
             if new_line is not None:    
                 fp.write(new_line)
Exemplo n.º 2
0
 def parser_cookie_file(self, replace=(".com", ".fm")):
     cookie_file = utils.get_cookie_file(self.username)
     if os.path.exists(cookie_file):
         with open(cookie_file, "rw+") as fp:
             new_line = None
             for line in fp:
                 if line.startswith("#HttpOnly_.douban"):
                     new_line = line.replace(replace[0], replace[1])
                     break
             if new_line is not None:
                 fp.write(new_line)
Exemplo n.º 3
0
    def __init__(self):
        cookie_file = utils.get_cookie_file()
        cj = cookielib.LWPCookieJar(cookie_file)
        cookie_handler = urllib2.HTTPCookieProcessor(cj)
        opener = urllib2.build_opener(cookie_handler)
        opener.addheaders = [
            (
                "User-agent",
                "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.24 "
                "(KHTML, like Gecko) Chrome/19.0.1056.0 Safari/535.24",
            )
        ]
        self.cookiejar = cj
        if os.path.isfile(cookie_file):
            self.cookiejar.load(ignore_discard=True, ignore_expires=True)
        self.opener = opener

        self.apidata = {}
Exemplo n.º 4
0
    def __init__(self, username, password):
        self.username = username
        self.password = password

        # 保存cookie
        cookie_file = utils.get_cookie_file(username)
        cj = cookielib.LWPCookieJar(cookie_file)
        cookie_handler = urllib2.HTTPCookieProcessor(cj)
        opener = urllib2.build_opener(cookie_handler)
        opener.addheaders = [
            ('User-agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.24 ' \
             '(KHTML, like Gecko) Chrome/19.0.1056.0 Safari/535.24'),]
        self.cookiejar = cj
        if os.path.isfile(cookie_file):
            self.cookiejar.load(ignore_discard=True, ignore_expires=True)

        self.opener = opener
        self.apidata = dict()
        self.__pickack = ""
        self.user_info = {}
        self.login_verify_code = ""
Exemplo n.º 5
0
 def __init__(self, username, password):
     self.username = username
     self.password = password
     
     # 保存cookie
     cookie_file = utils.get_cookie_file(username)
     cj = cookielib.LWPCookieJar(cookie_file)
     cookie_handler = urllib2.HTTPCookieProcessor(cj)
     opener = urllib2.build_opener(cookie_handler)
     opener.addheaders = [
         ('User-agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.24 ' \
          '(KHTML, like Gecko) Chrome/19.0.1056.0 Safari/535.24'),]
     self.cookiejar = cj
     if os.path.isfile(cookie_file):
         self.cookiejar.load(ignore_discard=True, ignore_expires=True)
     
     self.opener = opener
     self.apidata = dict()
     self.__pickack = ""
     self.user_info = {}
     self.login_verify_code = ""
Exemplo n.º 6
0
 def __init__(self, username, password):
     self.cookie_file = utils.get_cookie_file(username)
     self.curl = Curl(self.cookie_file)
     self.username = username
     self.password = password
     self.__bduss = None
Exemplo n.º 7
0
 def __init__(self, username, password):
     self.cookie_file = utils.get_cookie_file(username)
     self.curl = Curl(self.cookie_file)
     self.username = username
     self.password = password
     self.__bduss = None
Exemplo n.º 8
0
 def load_user_cookie(self):    
     cookie_file = utils.get_cookie_file(self.username)
     self.mycurl.set_cookie_file(cookie_file)
Exemplo n.º 9
0
 def load_user_cookie(self):
     cookie_file = utils.get_cookie_file(self.username)
     self.mycurl.set_cookie_file(cookie_file)