Skip to main content

A random user-agent for all your needs

Project description

scrapy-random-useragent-pro

Random UserAgent middleware for Scrapy.

You can chose your preferred ua in request.meta[desktop,mobile,bot].

Install

pip install scrapy-random-useragent-pro

Usage

settings.py

RANDOM_UA_ENABLED = True
RANDOM_UA_DEFAULT_TYPE = 'mobile'
# always change user-agent
RANDOM_UA_OVERWRITE = False


DOWNLOADER_MIDDLEWARES = {
    'scrapy_random_useragent_pro.middleware.RandomUserAgentMiddleware': 100,
    'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware': None,# important
}

In your code

yield Request('http://scrapytest.org/', meta={'ua': 'mobile'})

Project details


Release history Release notifications

This version

1.0.0

Download files

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

Files for scrapy-random-useragent-pro, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size scrapy_random_useragent_pro-1.0.0-py2.py3-none-any.whl (5.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size scrapy-random-useragent-pro-1.0.0.tar.gz (3.9 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