• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python json_layer.json_loads函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中module.common.json_layer.json_loads函数的典型用法代码示例。如果您正苦于以下问题:Python json_loads函数的具体用法?Python json_loads怎么用?Python json_loads使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了json_loads函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: handleFree

    def handleFree(self):
        found = re.search(self.WAIT_PATTERN, self.html)
        seconds = int(found.group(1))
        self.logDebug("Found wait", seconds)
        self.setWait(seconds + 1)
        self.wait()
        response = self.load('http://cloudzer.net/io/ticket/slot/%s' % self.file_info['ID'], post=' ', cookies=True)
        self.logDebug("Download slot request response", response)
        response = json_loads(response)
        if response["succ"] is not True:
            self.fail("Unable to get a download slot")

        recaptcha = ReCaptcha(self)
        challenge, response = recaptcha.challenge(self.CAPTCHA_KEY)
        post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response}
        response = json_loads(self.load('http://cloudzer.net/io/ticket/captcha/%s' % self.file_info['ID'], post=post_data, cookies=True))
        self.logDebug("Captcha check response", response)
        self.logDebug("First check")

        if "err" in response:
            if response["err"] == "captcha":
                self.logDebug("Wrong captcha")
                self.invalidCaptcha()
                self.retry()
            elif "Sie haben die max" in response["err"] or "You have reached the max" in response["err"]:
                self.logDebug("Download limit reached, waiting an hour")
                self.setWait(3600, True)
                self.wait()
        if "type" in response:
            if response["type"] == "download":
                url = response["url"]
                self.logDebug("Download link", url)
                self.download(url, disposition=True)
开发者ID:AlexandrePinheiro,项目名称:pyload,代码行数:33,代码来源:CloudzerNet.py


示例2: handleFree

    def handleFree(self):
        ukey = re.search(self.__pattern__, self.pyfile.url).group(1)
        json_url = "http://ifile.it/new_download-request.json"
        post_data = {"ukey": ukey, "ab": "0"}

        json_response = json_loads(self.load(json_url, post=post_data))
        self.logDebug(json_response)
        if json_response["status"] == 3:
            self.offline()

        if json_response["captcha"]:
            captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1)
            recaptcha = ReCaptcha(self)
            post_data["ctype"] = "recaptcha"

            for i in range(5):
                post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key)
                json_response = json_loads(self.load(json_url, post=post_data))
                self.logDebug(json_response)

                if json_response["retry"]:
                    self.invalidCaptcha()
                else:
                    self.correctCaptcha()
                    break
            else:
                self.fail("Incorrect captcha")

        if not "ticket_url" in json_response:
            self.parseError("Download URL")

        self.download(json_response["ticket_url"])
开发者ID:tetratec,项目名称:shareacc,代码行数:32,代码来源:IfileIt.py


示例3: challenge

    def challenge(self, html):
        adyoulike_data_string = None
        found = re.search(self.ADYOULIKE_INPUT_PATTERN, html)
        if found:
            adyoulike_data_string = found.group(1)
        else:
            self.plugin.fail("Can't read AdYouLike input data")

        # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
        # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
        ayl_data = json_loads(adyoulike_data_string)

        res = self.plugin.load(
            r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % {
            "ayl_key": ayl_data[self.engine]["key"], "ayl_env": ayl_data["all"]["env"],
            "callback": self.ADYOULIKE_CALLBACK})

        found = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res)
        challenge_string = None
        if found:
            challenge_string = found.group(1)
        else:
            self.plugin.fail("Invalid AdYouLike challenge")
        challenge_data = json_loads(challenge_string)

        return ayl_data, challenge_data
开发者ID:DasLampe,项目名称:pyload,代码行数:26,代码来源:DlFreeFr.py


示例4: result

    def result(self, server, challenge):
        # Adyoulike.g._jsonp_5579316662423138
        # ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
        # "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],
        # "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike",
        # "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
        # height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,
        # "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},
        # "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},
        # "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})

        if isinstance(server, basestring):
            server = json_loads(server)

        if isinstance(challenge, basestring):
            challenge = json_loads(challenge)

        try:
            instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual']
            result = re.search(u'«(.+?)»', instructions_visual).group(1).strip()

        except AttributeError:
            errmsg = _("AdYouLike result not found")
            self.plugin.fail(errmsg)
            raise AttributeError(errmsg)

        result = {'_ayl_captcha_engine' : "adyoulike",
                  '_ayl_env'            : server['all']['env'],
                  '_ayl_tid'            : challenge['tid'],
                  '_ayl_token_challenge': challenge['token'],
                  '_ayl_response'       : response}

        self.logDebug("Result: %s" % result)

        return result
开发者ID:kurtiss,项目名称:htpc,代码行数:35,代码来源:CaptchaService.py


示例5: handle_free

    def handle_free(self, pyfile):
        m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
        if m:
            pyfile.error = encode(m.group(1))
            self.log_warning(pyfile.error)
            self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error)

        ajax_url = "http://uploading.com/files/get/?ajax"
        self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
        self.req.http.lastURL = pyfile.url

        res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']}))

        if 'answer' in res and 'wait_time' in res['answer']:
            wait_time = int(res['answer']['wait_time'])
            self.log_info(_("Waiting %d seconds") % wait_time)
            self.wait(wait_time)
        else:
            self.error(_("No AJAX/WAIT"))

        res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['pattern']['ID'], 'pass': 'false'}))

        if 'answer' in res and 'link' in res['answer']:
            url = res['answer']['link']
        else:
            self.error(_("No AJAX/URL"))

        self.html = self.load(url)
        m = re.search(r'<form id="file_form" action="(.*?)"', self.html)
        if m:
            url = m.group(1)
        else:
            self.error(_("No URL"))

        self.link = url
开发者ID:earthGavinLee,项目名称:pyload,代码行数:35,代码来源:UploadingCom.py


示例6: challenge

    def challenge(self, key=None, html=None):
        if not key:
            if self.detect_key(html):
                key = self.key
            else:
                errmsg = _("AdYouLike key not found")
                self.plugin.fail(errmsg)
                raise TypeError(errmsg)

        ayl, callback = key

        # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
        # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
        ayl = json_loads(ayl)

        html = self.plugin.req.load("http://api-ayl.appspot.com/challenge",
                                    get={'key'     : ayl['adyoulike']['key'],
                                         'env'     : ayl['all']['env'],
                                         'callback': callback})
        try:
            challenge = json_loads(re.search(callback + r'\s*\((.+?)\)', html).group(1))

        except AttributeError:
            errmsg = _("AdYouLike challenge pattern not found")
            self.plugin.fail(errmsg)
            raise AttributeError(errmsg)

        self.logDebug("Challenge: %s" % challenge)

        return self.result(ayl, challenge), challenge
开发者ID:kurtiss,项目名称:htpc,代码行数:30,代码来源:CaptchaService.py


示例7: result

    def result(self, server, challenge):
        #: Adyoulike.g._jsonp_5579316662423138
        #: ({'translations':{'fr':{'instructions_visual':"Recopiez « Soonnight » ci-dessous :"}},
        #: 'site_under':true,'clickable':true,'pixels':{'VIDEO_050':[],'DISPLAY':[],'VIDEO_000':[],'VIDEO_100':[],
        #: 'VIDEO_025':[],'VIDEO_075':[]},'medium_type':"image/adyoulike",
        #: 'iframes':{'big':"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
        #: height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},'shares':{},'id':256,
        #: 'token':"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1",'formats':{'small':{'y':300,'x':0,'w':300,'h':60},
        #: 'big':{'y':0,'x':0,'w':300,'h':250},'hover':{'y':440,'x':0,'w':300,'h':60}},
        #: 'tid':"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})

        if isinstance(server, basestring):
            server = json_loads(server)

        if isinstance(challenge, basestring):
            challenge = json_loads(challenge)

        try:
            instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual']
            result = re.search(u'«(.+?)»', instructions_visual).group(1).strip()

        except AttributeError:
            self.fail(_("AdYouLike result not found"))

        result = {'_ayl_captcha_engine' : "adyoulike",
                  '_ayl_env'            : server['all']['env'],
                  '_ayl_tid'            : challenge['tid'],
                  '_ayl_token_challenge': challenge['token'],
                  '_ayl_response'       : response}

        self.log_debug("Result: %s" % result)

        return result
开发者ID:earthGavinLee,项目名称:pyload,代码行数:33,代码来源:AdYouLike.py


示例8: process

    def process(self, pyfile):

        if re.match(self.__pattern__, pyfile.url):
            link_status = {'generated': pyfile.url}
        elif not self.account:
            # Check account
            self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet")
            self.fail("No rpnet account provided")
        else:
            (user, data) = self.account.selectAccount()

            self.logDebug("Original URL: %s" % pyfile.url)
            # Get the download link 
            response = self.load("https://premium.rpnet.biz/client_api.php",
                                 get={"username": user, "password": data['password'],
                                      "action": "generate", "links": self.pyfile.url})

            self.logDebug("JSON data: %s" % response)
            link_status = json_loads(response)['links'][0]  # get the first link... since we only queried one

            # Check if we only have an id as a HDD link
            if 'id' in link_status:
                self.logDebug("Need to wait at least 30 seconds before requery")
                self.setWait(30)  # wait for 30 seconds
                self.wait()
                # Lets query the server again asking for the status on the link,
                # we need to keep doing this until we reach 100
                max_tries = 30
                my_try = 0
                while (my_try <= max_tries):
                    self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
                    response = self.load("https://premium.rpnet.biz/client_api.php",
                                         get={"username": user, "password": data['password'],
                                              "action": "downloadInformation", "id": link_status['id']})
                    self.logDebug("JSON data hdd query: %s" % response)
                    download_status = json_loads(response)['download']

                    if download_status['status'] == '100':
                        link_status['generated'] = download_status['rpnet_link']
                        self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
                        break
                    else:
                        self.logDebug("At %s%% for the file download" % download_status['status'])

                    self.setWait(30)
                    self.wait()
                    my_try += 1

                if my_try > max_tries:  # We went over the limit!
                    self.fail("Waited for about 15 minutes for download to finish but failed")

        if 'generated' in link_status:
            self.download(link_status['generated'], disposition=True)
        elif 'error' in link_status:
            self.fail(link_status['error'])
        else:
            self.fail("Something went wrong, not supposed to enter here")
开发者ID:BlackSmith,项目名称:pyload,代码行数:57,代码来源:RPNetBiz.py


示例9: handle_premium

    def handle_premium(self, pyfile):
        user, info = self.account.select()

        #: Get the download link
        res = self.load("https://premium.rpnet.biz/client_api.php",
                        get={'username': user,
                             'password': info['login']['password'],
                             'action'  : "generate",
                             'links'   : pyfile.url})

        self.log_debug("JSON data: %s" % res)
        link_status = json_loads(res)['links'][0]  #: Get the first link... since we only queried one

        #: Check if we only have an id as a HDD link
        if 'id' in link_status:
            self.log_debug("Need to wait at least 30 seconds before requery")
            self.wait(30)  #: Wait for 30 seconds
            #: Lets query the server again asking for the status on the link,
            #: We need to keep doing this until we reach 100
            max_tries = 30
            my_try = 0
            while (my_try <= max_tries):
                self.log_debug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
                res = self.load("https://premium.rpnet.biz/client_api.php",
                                get={'username': user,
                                     'password': info['login']['password'],
                                     'action'  : "downloadInformation",
                                     'id'      : link_status['id']})
                self.log_debug("JSON data hdd query: %s" % res)
                download_status = json_loads(res)['download']

                if download_status['status'] == "100":
                    link_status['generated'] = download_status['rpnet_link']
                    self.log_debug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
                    break
                else:
                    self.log_debug("At %s%% for the file download" % download_status['status'])

                self.wait(30)
                my_try += 1

            if my_try > max_tries:  #: We went over the limit!
                self.fail(_("Waited for about 15 minutes for download to finish but failed"))

        if 'generated' in link_status:
            self.link = link_status['generated']
            return
        elif 'error' in link_status:
            self.fail(link_status['error'])
        else:
            self.fail(_("Something went wrong, not supposed to enter here"))
开发者ID:earthGavinLee,项目名称:pyload,代码行数:51,代码来源:RPNetBiz.py


示例10: api_response

    def api_response(self, api="captcha", post=False, multipart=False):
        req = getRequest()
        req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version])

        if post:
            if not isinstance(post, dict):
                post = {}
            post.update({"username": self.getConfig("username"),
                         "password": self.getConfig("passkey")})

        res = None
        try:
            json = req.load("%s%s" % (self.API_URL, api),
                            post=post,
                            multipart=multipart)
            self.logDebug(json)
            res = json_loads(json)

            if "error" in res:
                raise DeathByCaptchaException(res['error'])
            elif "status" not in res:
                raise DeathByCaptchaException(str(res))

        except BadHeader, e:
            if 403 == e.code:
                raise DeathByCaptchaException('not-logged-in')
            elif 413 == e.code:
                raise DeathByCaptchaException('invalid-captcha')
            elif 503 == e.code:
                raise DeathByCaptchaException('service-overload')
            elif e.code in (400, 405):
                raise DeathByCaptchaException('invalid-request')
            else:
                raise
开发者ID:kurtiss,项目名称:htpc,代码行数:34,代码来源:DeathByCaptcha.py


示例11: get_json_response

    def get_json_response(self, get_dict, post_dict, field):
        res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict))

        self.log_debug(res)

        if not 'js' in res:
            self.error(_("JSON %s 1") % field)

        #: I changed js_answer to res['js'] since js_answer is nowhere set.
        #: I don't know the JSON-HTTP specs in detail, but the previous author
        #: Accessed res['js']['error'] as well as js_answer['error'].
        #: See the two lines commented out with  "# ~?".
        if 'error' in res['js']:

            if res['js']['error'] == "download_delay":
                self.retry(wait_time=res['js']['params']['next_download'])
                #: ~? self.retry(wait_time=js_answer['params']['next_download'])

            elif 'Wrong file password' in res['js']['error'] \
                 or 'You entered a wrong CAPTCHA code' in res['js']['error'] \
                 or 'CAPTCHA Code nicht korrekt' in res['js']['error']:
                return None

            elif 'CAPTCHA' in res['js']['error']:
                self.log_debug("Error response is unknown, but mentions CAPTCHA")
                return None

            else:
                self.fail(res['js']['error'])

        if not 'answer' in res['js'] or not field in res['js']['answer']:
            self.error(_("JSON %s 2") % field)

        return res['js']['answer'][field]
开发者ID:earthGavinLee,项目名称:pyload,代码行数:34,代码来源:FilepostCom.py


示例12: process

    def process(self, pyfile):
        if re.match(self.__pattern__, pyfile.url):
            new_url = pyfile.url
        elif not self.account:
            self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix")
            self.fail("No Fastix account provided")
        else:
            self.logDebug("Old URL: %s" % pyfile.url)
            api_key = self.account.getAccountData(self.user)
            api_key = api_key["api"]
            url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url)
            page = self.load(url)
            data = json_loads(page)
            self.logDebug("Json data: %s" % str(data))
            if "error\":true" in page:
                self.offline()
            else:
                new_url = data["downloadlink"]

        if new_url != pyfile.url:
            self.logDebug("New URL: %s" % new_url)

        if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
            #only use when name wasnt already set
            pyfile.name = self.getFilename(new_url)

        self.download(new_url, disposition=True)

        check = self.checkDownload({"error": "<title>An error occurred while processing your request</title>",
                                    "empty": re.compile(r"^$")})

        if check == "error":
            self.retry(reason="An error occurred while generating link.", wait_time=60)
        elif check == "empty":
            self.retry(reason="Downloaded File was empty.", wait_time=60)
开发者ID:BlackSmith,项目名称:pyload,代码行数:35,代码来源:FastixRu.py


示例13: getJsonResponse

 def getJsonResponse(self, get_dict, post_dict, field):     
     json_response = json_loads(self.load('https://filepost.com/files/get/', get = get_dict, post = post_dict))
     self.logDebug(json_response)
     
     if not 'js' in json_response: self.parseError('JSON %s 1' % field)       
     
     # i changed js_answer to json_response['js'] since js_answer is nowhere set.
     # i don't know the JSON-HTTP specs in detail, but the previous author
     # accessed json_response['js']['error'] as well as js_answer['error'].
     # see the two lines commented out with  "# ~?".
     if 'error' in json_response['js']:
         if json_response['js']['error'] == 'download_delay':
             self.retry(json_response['js']['params']['next_download'])
             # ~? self.retry(js_answer['params']['next_download'])
         elif 'Wrong file password' in json_response['js']['error']:
             return None 
         elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']:
             return None  
         elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']:
             return None
         elif 'CAPTCHA' in json_response['js']['error']:
             self.logDebug('error response is unknown, but mentions CAPTCHA -> return None')
             return None
         else:
             self.fail(json_response['js']['error'])
             # ~? self.fail(js_answer['error'])
     
     if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: 
         self.parseError('JSON %s 2' % field)
         
     return json_response['js']['answer'][field]
开发者ID:4Christopher,项目名称:pyload,代码行数:31,代码来源:FilepostCom.py


示例14: do_recaptcha

    def do_recaptcha(self):
        self.logDebug('Trying to solve captcha')
        captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
        shortencode = re.search(self.CAPTCHA_SHORTENCODE_PATTERN, self.html).group(1)
        url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1)

        recaptcha = ReCaptcha(self)

        for i in range(5):
            challenge, code = recaptcha.challenge(captcha_key)

            response = json_loads(self.load(self.file_info['HOST'] + '/rest/captcha/test',
                                            post={'challenge': challenge,
                                                  'response': code,
                                                  'shortencode': shortencode}))
            self.logDebug("reCaptcha response : %s" % response)
            if response == True:
                self.correctCaptcha()
                break
            else:
                self.invalidCaptcha()
        else:
            self.fail("Invalid captcha")

        return url
开发者ID:DasLampe,项目名称:pyload,代码行数:25,代码来源:ZippyshareCom.py


示例15: decrypt

    def decrypt(self, pyfile):
        self.html = self.load(pyfile.url)
        found = re.search(self.ML_LINK_PATTERN, self.html)
        ml_url = found.group(1) if found else None
        
        json_list = json_loads(self.load("http://multiupload.com/progress/", get = {
            "d": re.search(self.__pattern__, pyfile.url).group(1),
            "r": str(int(time()*1000))        
            }))
        new_links = []
               
        prefered_set = map(lambda s: s.lower().split('.')[0], set(self.getConfig("preferedHoster").split('|')))       
        
        if ml_url and 'multiupload' in prefered_set: new_links.append(ml_url)               
        
        for link in json_list:          
            if link['service'].lower() in prefered_set and int(link['status']) and not int(link['deleted']):
                url = self.getLocation(link['url'])
                if url: new_links.append(url)        

        if not new_links:                    
            ignored_set = map(lambda s: s.lower().split('.')[0], set(self.getConfig("ignoredHoster").split('|')))
            
            if 'multiupload' not in ignored_set: new_links.append(ml_url)                   
        
            for link in json_list:         
                if link['service'].lower() not in ignored_set and int(link['status']) and not int(link['deleted']):
                    url = self.getLocation(link['url'])
                    if url: new_links.append(url)

        if new_links:
            self.core.files.addLinks(new_links, self.pyfile.package().id)
        else:
            self.fail('Could not extract any links')
开发者ID:4Christopher,项目名称:pyload,代码行数:34,代码来源:MultiuploadCom.py


示例16: checkFile

    def checkFile(self, url):
        id = getId(url)
        self.logDebug("file id is %s" % id)
        if id:
            # Use the api to check the current status of the file and fixup data
            check_url = self.API_ADDRESS + "/link?method=getInfo&format=json&ids=%s" % id
            result = json_loads(self.load(check_url, decode=True))
            item = result["FSApi_Link"]["getInfo"]["response"]["links"][0]
            self.logDebug("api check returns %s" % item)

            if item["status"] != "AVAILABLE":
                self.offline()
            if item["is_password_protected"] != 0:
                self.fail("This file is password protected")

            # ignored this check due to false api information
            #if item["is_premium_only"] != 0 and not self.premium:
            #    self.fail("need premium account for file")

            self.pyfile.name = unquote(item["filename"])

            # Fix the url and resolve the domain to the correct regional variation
            url = item["url"]
            urlparts = re.search(self.URL_DOMAIN_PATTERN, url)
            if urlparts:
                url = urlparts.group("prefix") + self.getDomain() + urlparts.group("suffix")
                self.logDebug("localised url is %s" % url)
            return url
        else:
            self.fail("Invalid URL")
开发者ID:Tony763,项目名称:pyload,代码行数:30,代码来源:WuploadCom.py


示例17: getAccountStatus

    def getAccountStatus(self, user, req):
        password  = self.getAccountData(user)['password']
        salt      = hashlib.sha256(password).hexdigest()
        encrypted = PBKDF2(password, salt, iterations=1000).hexread(32)

        return json_loads(req.load("http://www2.smoozed.com/api/login",
                                   get={'auth': user, 'password': encrypted}))
开发者ID:kurtiss,项目名称:htpc,代码行数:7,代码来源:SmoozedCom.py


示例18: submit

    def submit(self, captcha, captchaType="file", match=None):
        if not PYLOAD_KEY:
            raise CaptchaTraderException("No API Key Specified!")

        #if type(captcha) == str and captchaType == "file":
        #    raise CaptchaTraderException("Invalid Type")
        assert captchaType in ("file", "url-jpg", "url-jpeg", "url-png", "url-bmp")

        req = getRequest()

        #raise timeout threshold
        req.c.setopt(LOW_SPEED_TIME, 80)

        try:
            json = req.load(CaptchaTrader.SUBMIT_URL, post={"api_key": PYLOAD_KEY,
                                                            "username": self.getConfig("username"),
                                                            "password": self.getConfig("passkey"),
                                                            "value": (FORM_FILE, captcha),
                                                            "type": captchaType}, multipart=True)
        finally:
            req.close()

        response = json_loads(json)
        if response[0] < 0:
            raise CaptchaTraderException(response[1])

        ticket = response[0]
        result = response[1]
        self.logDebug("result %s : %s" % (ticket, result))

        return ticket, result
开发者ID:BlackSmith,项目名称:pyload,代码行数:31,代码来源:CaptchaTrader.py


示例19: handle_free

    def handle_free(self, pyfile):
        action, inputs = self.parse_html_form('id="frm-downloadDialog-freeDownloadForm"')
        if not action or not inputs:
            self.error(_("Free download form not found"))

        self.log_debug("inputs.keys = " + str(inputs.keys()))
        #: Get and decrypt captcha
        if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")):
            #: Old version - last seen 9.12.2013
            self.log_debug('Using "old" version')

            captcha_value = self.captcha.decrypt("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id'])
            self.log_debug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value)

            inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value})

        elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")):
            #: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013
            self.log_debug('Using "new" version')

            xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))})
            self.log_debug("xapca = " + str(xapca))

            data = json_loads(xapca)
            captcha_value = self.captcha.decrypt(str(data['image']))
            self.log_debug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value)

            inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value})

        else:
            self.error(_("CAPTCHA form changed"))

        self.download("http://www.ulozto.net" + action, post=inputs)
开发者ID:earthGavinLee,项目名称:pyload,代码行数:33,代码来源:UlozTo.py


示例20: get_info

def get_info(urls):
    result  = []
    regex   = re.compile(DailymotionCom.__pattern__)
    apiurl  = "https://api.dailymotion.com/video/%s"
    request = {'fields': "access_error,status,title"}

    for url in urls:
        id   = regex.match(url).group('ID')
        html = get_url(apiurl % id, get=request)
        info = json_loads(html)

        name = info['title'] + ".mp4" if "title" in info else url

        if "error" in info or info['access_error']:
            status = "offline"
        else:
            status = info['status']
            if status in ("ready", "published"):
                status = "online"
            elif status in ("waiting", "processing"):
                status = "temp. offline"
            else:
                status = "offline"

        result.append((name, 0, statusMap[status], url))

    return result
开发者ID:earthGavinLee,项目名称:pyload,代码行数:27,代码来源:DailymotionCom.py



注:本文中的module.common.json_layer.json_loads函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python RequestFactory.getURL函数代码示例发布时间:2022-05-27
下一篇:
Python module.ModuleDetector类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap