Coder Social home page Coder Social logo

http-crawler's Introduction

http-crawler

http-crawler is a library for crawling websites. It uses requests to speak HTTP.

Installation

Install with pip:

$ pip install http-crawler

Usage

The http_crawler module provides one generator function, crawl.

crawl is called with a URL, and yields instances of requests's Response class.

crawl will request the page at the given URL, and will extract all URLs from the response. It will then make a request for each of those URLs, and will repeat the process until it has requested every URL linked to from pages on the original URL's domain. It will not extract or process URLs from any page with a different domain to the original URL.

For instance, this is how you would use crawl to find and log any broken links on a site:

>>> from http_crawler import crawl
>>> for rsp in crawl('http://www.example.com'):
>>>     if rsp.status_code != 200:
>>>         print('Got {} at {}'.format(rsp.status_code, rsp.url))

Motivation

Why another crawling library? There are certainly lots of Python tools for crawling websites, but all that I could find were either too complex, too simple, or had too many dependencies.

http-crawler is designed to be a library and not a framework, so it should be straightforward to use in applications or other libraries.

Contributing

There are a handful of enhancements on the issue tracker that would be suitable for somebody looking to contribute to Open Source for the first time.

For instructions about making Pull Requests, see GitHub's guide.

All contributions should include tests with 100% code coverage, and should comply with PEP 8. The project uses tox for running tests and checking code quality metrics.

To run the tests:

$ tox

http-crawler's People

Contributors

inglesp avatar

Watchers

James Cloos avatar Krishna Ram Prakash R avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.