ruia_ua - simple user-agent middleware for Ruia.
Project description
ruia-ua
simple user-agent middleware for Ruia
Installation
pip install -U ruia-ua
Usage
ruia-ua
will be automatically with a random User-Agent
for your request's headers
from ruia import AttrField, TextField, Item, Spider
from ruia_ua import middleware
class HackerNewsItem(Item):
target_item = TextField(css_select='tr.athing')
title = TextField(css_select='a.storylink')
url = AttrField(css_select='a.storylink', attr='href')
class HackerNewsSpider(Spider):
start_urls = ['https://news.ycombinator.com/news?p=1', 'https://news.ycombinator.com/news?p=2']
async def parse(self, response):
# Do something...
print(response.html)
if __name__ == '__main__':
HackerNewsSpider.start(middleware=middleware)
Enjoy it :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ruia_ua-0.0.2.tar.gz
(11.3 kB
view details)
Built Distribution
ruia_ua-0.0.2-py3-none-any.whl
(11.5 kB
view details)
File details
Details for the file ruia_ua-0.0.2.tar.gz
.
File metadata
- Download URL: ruia_ua-0.0.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bec4dc3b06cdbbda4254ee9d620230c65fe23abb51ba0829271a3b7594aa7e7 |
|
MD5 | 1e35f88a450ce0fafc5703200d0bab4b |
|
BLAKE2b-256 | 126089c360dabd57c109bfb4271e00c826fcaac25366310476e362c295990137 |
File details
Details for the file ruia_ua-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: ruia_ua-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85b0fbbe79836d157db982e9b264cb44de3dfab550ebf15f946d871cd1596b87 |
|
MD5 | 940a5475548623ab46d51f75cb79d654 |
|
BLAKE2b-256 | 2adccc923a637d6fef4fa34efd1e02f17e7077d14672a230fbfb061855253c6e |