Skip to main content
Help us improve Python packaging – donate today!

Web Scraping Framework based on py3 asyncio

Project Description

https://travis-ci.org/lorien/crawler.png?branch=master https://coveralls.io/repos/lorien/crawler/badge.svg?branch=master https://pypip.in/download/crawler/badge.svg?period=month https://landscape.io/github/lorien/crawler/master/landscape.png

Web scraping framework based on py3 asyncio & aiohttp libraries.

Usage Example

import re
from itertools import islice

from crawler import Crawler, Request

RE_TITLE = re.compile(r'<title>([^<]+)</title>', re.S | re.I)

class TestCrawler(Crawler):
    def task_generator(self):
        for host in islice(open('var/domains.txt'), 100):
            host = host.strip()
            if host:
                yield Request('http://%s/' % host, tag='page')

    def handler_page(self, req, res):
        print('Result of request to {}'.format(req.url))
        try:
            title = RE_TITLE.search(res.body).group(1)
        except AttributeError:
            title = 'N/A'
        print('Title: {}'.format(title))

bot = TestCrawler(concurrency=10)
bot.run()

Installation

pip install crawler

Dependencies

  • Python>=3.4
  • aiohttp

Release history Release notifications

This version
History Node

0.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
crawler-0.0.2.tar.gz (6.0 kB) Copy SHA256 hash SHA256 Source None Jun 15, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page