Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

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


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
Filename, size scrapy-random-useragent-pro-1.0.0.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page