This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Crawlera middleware for Scrapy

Project Description

scrapy-crawlera provides easy use of Crawlera with Scrapy.


You can install scrapy-crawlera using pip:

pip install scrapy-crawlera


  • Add the Crawlera middleware including it into the DOWNLOADER_MIDDLEWARES in your file:

        'scrapy_crawlera.CrawleraMiddleware': 610
  • Then there are two ways to enable it.

    • Through

      CRAWLERA_APIKEY = 'apikey'
    • Through spider attributes:

      class MySpider:
          crawlera_enabled = True
          crawlera_apikey = 'apikey'

How to use it

With the middleware, the usage of crawlera is automatic, every request will go through crawlera without nothing to worry about.

Remember that you are now making request to Crawlera, and the Crawlera service will be the one actually making the requests to the different sites.

If you need to specify special Crawlera Headers, just apply them as normal Scrapy Headers.

Here we have an example of specifying a Crawlera header into a Scrapy request:

        'X-Crawlera-Max-Retries': 1,

Remember that you could also set which headers to use by default by all requests with DEFAULT_REQUEST_HEADERS


v1.2.2 (2017-01-19)

  • Fix Crawlera error stats key in Python 3.
  • Add support for Python 3.6.

v1.2.1 (2016-10-17)

Fix release date in README.

v1.2.0 (2016-10-17)

  • Recommend middleware order to be 610 to run before RedirectMiddleware.
  • Change default download timeout to 190s or 3 minutes 10 seconds (instead of 1800s or 30 minutes).
  • Test and advertize Python 3 compatiblity.
  • New crawlera/request and crawlera/request/method/* stats counts.
  • Clear Scrapy DNS cache for proxy URL in case of connection errors.
  • Distribute plugin as universal wheel.
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
scrapy_crawlera-1.2.2-py2.py3-none-any.whl (5.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jan 19, 2017
scrapy-crawlera-1.2.2.tar.gz (4.6 kB) Copy SHA256 Checksum SHA256 Source Jan 19, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting