معرفی شرکت ها


cacheproxy-0.1.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Simple Python cache/caching proxy for Web development and something else
ویژگی مقدار
سیستم عامل -
نام فایل cacheproxy-0.1.0
نام cacheproxy
نسخه کتابخانه 0.1.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده nolze
ایمیل نویسنده nolze@int3.net
آدرس صفحه اصلی https://github.com/nolze/cacheproxy
آدرس اینترنتی https://pypi.org/project/cacheproxy/
مجوز MIT
# CacheProxy [![test](https://github.com/nolze/cacheproxy/actions/workflows/test.yaml/badge.svg)](https://github.com/nolze/cacheproxy/actions/workflows/test.yaml) A simple Python cache/caching proxy for Web development and something else, built on [aiohttp](https://github.com/aio-libs/aiohttp) and [aiohttp-client-cache](https://github.com/requests-cache/aiohttp-client-cache) (a family project of [requests-cache](https://github.com/requests-cache/requests-cache)). Useful to avoid unfavorable massive accesses to external APIs during development, with little change, without preparing mocks. Not recommended for production. ## Install ```bash pip install cacheproxy ``` ## Usage ### 1. Start up proxy ```bash $ cacheproxy sqlite -c ./cache --expire-after 1800 Cache database: /Users/nolze/src/cacheproxy/cache.sqlite ======== Running on http://0.0.0.0:8080 ======== (Press CTRL+C to quit) ``` Other backends: ```bash cacheproxy # in-memory cacheproxy memory # in-memory cacheproxy file -c ./cache # file-based, saved under ./cache/ cacheproxy sqlite -c ./cache # sqlite, saved to ./cache.sqlite ``` ### 2. Access through proxy cURL: ```bash curl http://0.0.0.0:8080/api.github.com/repos/nolze/cacheproxy # This request is cached until the expiration time # → {"id":...,"node_id":"...","name":"cacheproxy", ... ``` Python (requests): ```python import requests base_url = "http://0.0.0.0:8080/api.github.com" # Just replace with "https://api.github.com" on production resp = requests.get(f"{base_url}/repos/nolze/cacheproxy") # or use urljoin() print(resp.json()) # → {'id': ...., 'node_id': '....', 'name': 'cacheproxy', ... ``` JavaScript/Node: ```javascript const baseURL = "http://0.0.0.0:8080/api.github.com"; // Just replace with "https://api.github.com" on production const resp = await fetch(`${baseURL}/repos/nolze/cacheproxy`); const data = await resp.json(); console.log(data); // → Object { id: ..., node_id: "...", name: "cacheproxy", ... ``` ### Interact with or modify cached data Use [aiohttp-client-cache](https://github.com/requests-cache/aiohttp-client-cache) to load existing databases. See also: - <https://aiohttp-client-cache.readthedocs.io/> ## Todos - [ ] Better error handling - [ ] Write tests - [ ] Better logging - [ ] Support POST/PUT - [ ] Support switching http/https (with --http/--https flags) - [ ] Support DynamoDB, MongoDB, and Redis backends ## License MIT


نیازمندی

مقدار نام
>=3.8.3,<4.0.0 aiohttp[speedups]
>=0.7.3,<0.8.0 aiohttp-client-cache
>=0.17.0,<0.18.0 aiosqlite
>=22.1.0,<23.0.0 aiofiles


زبان مورد نیاز

مقدار نام
>=3.8,<4.0 Python


نحوه نصب


نصب پکیج whl cacheproxy-0.1.0:

    pip install cacheproxy-0.1.0.whl


نصب پکیج tar.gz cacheproxy-0.1.0:

    pip install cacheproxy-0.1.0.tar.gz