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


Python Scraper.run方法代码示例

本文整理汇总了Python中scraper.Scraper.run方法的典型用法代码示例。如果您正苦于以下问题:Python Scraper.run方法的具体用法?Python Scraper.run怎么用?Python Scraper.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scraper.Scraper的用法示例。


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

示例1: main

# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import run [as 别名]
def main():
    uid = str(uuid.uuid4())

    print "Creating Scraper() instance ..."

    scraper = Scraper(uid)
    scraper.run()

    print "Running tests ..."

    # typelink()
    test_typelink(scraper)    

    # checkmatch()
    test_checkmatch(scraper)

    # getpagelinks
    test_getpagelinks(scraper)

    # folowlinks()
    test_followlinks(scraper)

    # get scraper status
    text_getstatus(scraper)

    scraper.stop();

    print "Done."
开发者ID:citruspi,项目名称:BarkingOwl,代码行数:30,代码来源:testscraper.py

示例2: mailbox_phones

# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import run [as 别名]
def mailbox_phones(host, user, current_host, username, password=False,
                   oauth_token=False, oauth_secret=False, port=993, send_email=True):
    """
        Task will run when user save mailbox information.
    """
    print "Start scraper!!!"
    scrap = Scraper(host, user, username, password, oauth_token, oauth_secret)
    ans = scrap.run()
    mailbox = MailBox.objects.get(username=username)
    mailbox.status = 2
    mailbox.save()

    if send_email:
        from django.core.mail import send_mail

        subject = render_to_string('scrape_email_subject.txt', {})
        # Email subject *must not* contain newlines
        subject = ''.join(subject.splitlines())

        message = render_to_string('scrape_email.txt', { 'host': current_host, 'count': ans })

        acc = user.get_profile()

        if acc.added_email and user.email != acc.added_email:
            send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [acc.added_email])
            send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email])
        else:
            send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email])

    mailbox = MailBox.objects.get(username=username)
    mailbox.status = 3
    mailbox.last_scrape = datetime.now()
    mailbox.save()
    print "stoped"

    return ans
开发者ID:greggy,项目名称:dijscrape,代码行数:38,代码来源:tasks.py

示例3:

# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import run [as 别名]
        """ type below the filters you would like to set"""
        
        if ('' not in msg.channel
            and '' not in msg.channel
            and '' not in msg.channel
            and '' not in msg.channel):
            return 
        """ type below the filters you would like to ignore"""
        
        if ('' in msg.channel
            or '' in msg.channel
            or '' in msg.channel
            or '' in msg.channel
            or '' in msg.channel
            or '' in msg.channel
            or '' in msg.channel):
            return

        params = {
            'token': app_token,
            'user': user_token,
            'title': msg.channel,
            'message': msg.text,
            'priority': 1 if msg.response else 0,
        }
        if msg.response: params['sound'] = 'siren'
        requests.post('https://api.pushover.net/1/messages.json', data=params)
        print "POSTed message"

    scraper.run()
开发者ID:a1646927,项目名称:cfsresd,代码行数:32,代码来源:daemon.py


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