当前位置: 首页>>代码示例>>Python>>正文


Python RequestFactory.getURL函数代码示例

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


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

示例1: notify

    def notify(self,
               event,
               msg="",
               key=self.getConfig('apikey')):

        if not key:
            return

        if self.core.isClientConnected() and not self.getConfig('ignoreclient'):
            return

        elapsed_time = time.time() - self.last_notify

        if elapsed_time < self.getConf("sendtimewait"):
            return

        if elapsed_time > 60:
            self.notifications = 0

        elif self.notifications >= self.getConf("sendpermin"):
            return


        getURL("http://www.notifymyandroid.com/publicapi/notify",
               get={'apikey'     : key,
                    'application': "pyLoad",
                    'event'      : event,
                    'description': msg})

        self.last_notify    = time.time()
        self.notifications += 1
开发者ID:Bobbaone,项目名称:pyload,代码行数:31,代码来源:AndroidPhoneNotify.py

示例2: getInfo

def getInfo(urls):
    for url in urls:
        h = getURL(url, just_header=True)
        m = re.search(r'Location: (.+)\r\n', h)
        if m and not re.match(m.group(1), FilefactoryCom.__pattern):  #: It's a direct link! Skipping
            yield (url, 0, 3, url)
        else:  #: It's a standard html page
            yield parseFileInfo(FilefactoryCom, url, getURL(url))
开发者ID:reissdorf,项目名称:pyload,代码行数:8,代码来源:FilefactoryCom.py

示例3: respond

def respond(ticket, value):
    conf = join(expanduser("~"), "ct.conf")
    f = open(conf, "rb")
    try:
        getURL("http://captchatrader.com/api/respond",
            post={"is_correct": value,
                  "username": f.readline().strip(),
                  "password": f.readline().strip(),
                  "ticket": ticket})
    except Exception, e :
        print "CT Exception:", e
        log(DEBUG, str(e))
开发者ID:Dinawhk,项目名称:pyload,代码行数:12,代码来源:PluginTester.py

示例4: respond

 def respond(self, ticket, success):
     try:
         res = getURL(
             self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), "cv": 1 if success else 0}
         )
     except BadHeader, e:
         self.logError(_("Could not send response"), e)
开发者ID:toroettg,项目名称:pyload,代码行数:7,代码来源:BypassCaptcha.py

示例5: getInfo

def getInfo(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 = getURL(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:Burnout5151,项目名称:pyload,代码行数:27,代码来源:DailymotionCom.py

示例6: _captchaResponse

    def _captchaResponse(self, task, correct):
        type = "correct" if correct else "refund"

        if 'ticket' not in task.data:
            self.logDebug("No CaptchaID for %s request (task: %s)" % (type, task))
            return

        passkey = self.getConfig('passkey')

        for _i in xrange(3):
            res = getURL(self.API_URL,
                         get={'action' : "usercaptchacorrectback",
                              'apikey' : passkey,
                              'api_key': passkey,
                              'correct': "1" if correct else "2",
                              'pyload' : "1",
                              'source' : "pyload",
                              'id'     : task.data['ticket']})

            self.logDebug("Request %s: %s" % (type, res))

            if res == "OK":
                break

            time.sleep(5)
        else:
            self.logDebug("Could not send %s request: %s" % (type, res))
开发者ID:PaddyPat,项目名称:pyload,代码行数:27,代码来源:Captcha9Kw.py

示例7: getInfo

def getInfo(urls):
    for url in urls:
        html = getURL("http://www.fshare.vn/check_link.php",
                      post={'action': "check_link", 'arrlinks': url},
                      decode=True)

        yield parseFileInfo(FshareVn, url, html)
开发者ID:PaddyPat,项目名称:pyload,代码行数:7,代码来源:FshareVn.py

示例8: getInfo

    def getInfo(cls, url="", html=""):
        info   = cls.apiInfo(url)
        online = info['status'] == 2

        try:
            info['pattern'] = re.match(cls.__pattern, url).groupdict()  #: pattern groups will be saved here

        except Exception:
            info['pattern'] = {}

        if not html and not online:
            if not url:
                info['error']  = "missing url"
                info['status'] = 1

            elif info['status'] is 3 and not getFileURL(None, url):
                try:
                    html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING)

                    if isinstance(cls.TEXT_ENCODING, basestring):
                        html = unicode(html, cls.TEXT_ENCODING)

                except BadHeader, e:
                    info['error'] = "%d: %s" % (e.code, e.content)

                    if e.code is 404:
                        info['status'] = 1

                    elif e.code is 503:
                        info['status'] = 6
开发者ID:reissdorf,项目名称:pyload,代码行数:30,代码来源:SimpleHoster.py

示例9: getInfo

    def getInfo(cls, url="", html=""):
        info = {
            "name": urlparse.urlparse(urllib.unquote(url)).path.split("/")[-1] or _("Unknown"),
            "size": 0,
            "status": 3 if url else 1,
            "url": url,
        }

        if url:
            info["pattern"] = re.match(cls.__pattern, url).groupdict()

            field = getURL(
                "http://api.share-online.biz/linkcheck.php",
                get={"md5": "1"},
                post={"links": info["pattern"]["ID"]},
                decode=True,
            ).split(";")

            if field[1] == "OK":
                info["fileid"] = field[0]
                info["status"] = 2
                info["name"] = field[2]
                info["size"] = field[3]  #: in bytes
                info["md5"] = field[4].strip().lower().replace("\n\n", "")  #: md5

            elif field[1] in ("DELETED", "NOT FOUND"):
                info["status"] = 1

        return info
开发者ID:toroettg,项目名称:pyload,代码行数:29,代码来源:ShareonlineBiz.py

示例10: api_response

    def api_response(self, api, ticket):
        res = getURL("%s%s.aspx" % (self.API_URL, api),
                     get={"username": self.getConfig('username'),
                          "password": self.getConfig('passkey'),
                          "captchaID": ticket})
        if not res.startswith("OK"):
            raise CaptchaBrotherhoodException("Unknown response: %s" % res)

        return res
开发者ID:PaddyPat,项目名称:pyload,代码行数:9,代码来源:CaptchaBrotherhood.py

示例11: captchaInvalid

    def captchaInvalid(self, task):
        if "ticket" in task.data:

            try:
                res = getURL(self.API_URL,
                             post={'action': "refund", 'key': self.getConfig('passkey'), 'gen_task_id': task.data['ticket']})
                self.logInfo(_("Request refund"), res)

            except BadHeader, e:
                self.logError(_("Could not send refund request"), e)
开发者ID:Bobbaone,项目名称:pyload,代码行数:10,代码来源:ExpertDecoders.py

示例12: getCredits

    def getCredits(self):
        res = getURL(self.API_URL, post={"key": self.getConfig('passkey'), "action": "balance"})

        if res.isdigit():
            self.logInfo(_("%s credits left") % res)
            self.info['credits'] = credits = int(res)
            return credits
        else:
            self.logError(res)
            return 0
开发者ID:Bobbaone,项目名称:pyload,代码行数:10,代码来源:ExpertDecoders.py

示例13: getCredits

 def getCredits(self):
     res = getURL(self.API_URL + "askCredits.aspx",
                  get={"username": self.getConfig('username'), "password": self.getConfig('passkey')})
     if not res.startswith("OK"):
         raise CaptchaBrotherhoodException(res)
     else:
         credits = int(res[3:])
         self.logInfo(_("%d credits left") % credits)
         self.info['credits'] = credits
         return credits
开发者ID:PaddyPat,项目名称:pyload,代码行数:10,代码来源:CaptchaBrotherhood.py

示例14: captchaTask

    def captchaTask(self, task):
        if self.getConfig('captcha') and task.isTextual():
            task.handler.append(self)
            task.setWaiting(60)

            html = getURL("http://www.freeimagehosting.net/upload.php",
                          post={"attached": (pycurl.FORM_FILE, task.captchaFile)}, multipart=True)

            url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", html).group(1)
            self.response(_("New Captcha Request: %s") % url)
            self.response(_("Answer with 'c %s text on the captcha'") % task.id)
开发者ID:Bobbaone,项目名称:pyload,代码行数:11,代码来源:IRCInterface.py

示例15: getInfo

def getInfo(urls):
    result = []

    for url in urls:

        html = getURL(url)
        if re.search(StreamCz.OFFLINE_PATTERN, html):
            # File offline
            result.append((url, 0, 1, url))
        else:
            result.append((url, 0, 2, url))
    yield result
开发者ID:Bobbaone,项目名称:pyload,代码行数:12,代码来源:StreamCz.py


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