Skip to main content

ruia_cache - A Ruia plugin for caching URL.

Project description

ruia-cache

A Ruia plugin for caching URL

Installation

pip install -U ruia-cache

# New features
pip install git+https://github.com/python-ruia/ruia-cache

Usage

ruia-cache will automatically cache the captured URL to prevent the second request to the target web page:

import os

from ruia_cache import RuiaCacheSpider

# Set RUIA_CACHE path
os.environ.setdefault(
    "RUIA_CACHE", os.path.dirname(__file__),
)


class Demo(RuiaCacheSpider):
    name = "demo_spider"
    start_urls = ["http://httpbin.org/get"]

    async def parse(self, response):
        html = await response.text()
        print(html)


if __name__ == "__main__":
    Demo.start()
    # Using cache data
    Demo.start()

Enjoy it :)

Project details


Download files

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

Source Distribution

ruia_cache-0.0.2.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

ruia_cache-0.0.2-py3-none-any.whl (11.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page