Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

RabbitMQ Plug-in for Scrapy

Project description

## A RabbitMQ Scheduler for Scrapy Framework.

Scrapy-rabbitmq is a tool that lets you feed and queue URLs from RabbitMQ via Scrapy spiders, using the [Scrapy framework](

Inpsired by and modled after [scrapy-redis](

## Installation

Using pip, type in your command-line prompt

pip install scrapy-rabbitmq

Or clone the repo and inside the scrapy-rabbitmq directory, type

python install

## Usage

### Step 1: In your scrapy settings, add the following config values:

# Enables scheduling storing requests queue in rabbitmq.

SCHEDULER = "scrapy_rabbitmq.scheduler.Scheduler"

# Don't cleanup rabbitmq queues, allows to pause/resume crawls.

# Schedule requests using a priority queue. (default)
SCHEDULER_QUEUE_CLASS = 'scrapy_rabbitmq.queue.SpiderQueue'

# RabbitMQ Queue to use to store requests
RABBITMQ_QUEUE_NAME = 'scrapy_queue'

# Provide host and port to RabbitMQ daemon
RABBITMQ_CONNECTION_PARAMETERS = {'host': 'localhost', 'port': 6666}

# Store scraped item in rabbitmq for post-processing.
'scrapy_rabbitmq.pipelines.RabbitMQPipeline': 1


### Step 2: Add RabbitMQMixin to Spider.

#### Example:

from scrapy.contrib.spiders import CrawlSpider
from scrapy_rabbitmq.spiders import RabbitMQMixin

class MultiDomainSpider(RabbitMQMixin, CrawlSpider):
name = 'multidomain'

def parse(self, response):
# parse all the things


### Step 3: Run spider using [scrapy client](

scrapy runspider

### Step 4: Push URLs to RabbitMQ

#### Example:

#!/usr/bin/env python
import pika
import settings

connection = pika.BlockingConnection(pika.ConnectionParameters(
channel =

body='</html>raw html contents<a href="">extract url</a></html>')



## Contributing and Forking

See [Contributing Guidlines](CONTRIBUTING.MD)

## Releases

See the [changelog]( for release details.

| Version | Release Date |
| :-----: | :----------: |
| 0.1.0 | 2014-11-14 |
| 0.1.1 | 2015-07-02 |

## Copyright & License

Copyright (c) 2015 Royce Haynes - Released under The MIT License.

Project details

Download files

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

Files for scrapy-rabbitmq, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size scrapy-rabbitmq-0.1.2.tar.gz (5.6 kB) File type Source Python version None Upload date Hashes View hashes
Filename, size (9.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

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