Skip to main content

Site Scraping Framework based on py3 asyncio

Project description

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

Web scraping framework based on py3 asyncio & aiohttp libraries.

Usage Example

import re
from itertools import islice

from iob 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 iob

Dependencies

  • Python>=3.4

  • aiohttp

Project details


Download files

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

Source Distribution

iob-0.0.2.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file iob-0.0.2.tar.gz.

File metadata

  • Download URL: iob-0.0.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for iob-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a86440277b1d91996c1f6c1c33a1219790962a504350adfc1f14771936bc3a77
MD5 42887a143f13d1c59f09ad8786084036
BLAKE2b-256 d69b4d2dadb823bdd27fe2ca45f19e33dce4d3aac3d02efa3a6087bd561bc145

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page