معرفی شرکت ها


etag-cache-0.2


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

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

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

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

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

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

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

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

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

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

مشاهده بیشتر

توضیحات

Python package for caching HTTP response based on etag
ویژگی مقدار
سیستم عامل -
نام فایل etag-cache-0.2
نام etag-cache
نسخه کتابخانه 0.2
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Rakesh R
ایمیل نویسنده rrrakesh265@gmail.com
آدرس صفحه اصلی https://github.com/ranjanrak/etag-response-cache
آدرس اینترنتی https://pypi.org/project/etag-cache/
مجوز MIT
# etag-response-cache Etag cache implementation for HTTP requests, to save request bandwidth for a non-modified response. Returns high-speed accessed dictionary data as cache. ## Concept Store Etag value(as hash key:value pair) in the user's home directory `os.path.join(os.getenv("HOME"), ".pyapp")` into `etag` and successful response data into `cache` DBM files.<br> Add `If-None-Match` header for all `GET` request.</br> Update `etag` and `cache` for required request url, when none 304 http status is received i.e if response is modified.</br> Return `cache` data as dictionary for non-modified response.</br> Sample `GET` request header with `If-None-Match`: ``` {'X-Kite-Version': '3', 'User-Agent': 'Kiteconnect-python/3.9.4', 'If-None-Match': 'W/"i51p01GqP6TRPWsM"', 'Authorization': 'token api_key:access_token'} ``` ## Installation ``` To-do: Release it as pypi package ``` ## Usage ```python import requests from etag_package import EtagCache cache_object = EtagCache() url = "https://api.kite.trade/portfolio/holdings" payload = "" headers = { 'x-kite-version': "3", 'authorization': "token api_key:access_token" } # Add etag to request header headers = cache_object.add_etag("GET", headers, url) response = requests.request("GET", url, data=payload, headers=headers) # Store etag from response header cache_object.save_etag(response) # Store response data as cache response_dict = cache_object.add_read_cache(response) print(response_dict) ``` ## Response ``` DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /portfolio/holdings HTTP/1.1" 304 0 {'tradingsymbol': 'APOLLOPIPE', 'exchange': 'NSE', 'instrument_token': 3676417, 'isin': 'INE126J01016', 'product': 'CNC', 'price': 0, 'quantity': 3, 'used_quantity': 0, 't1_quantity': 0, 'realised_quantity': 3, 'authorised_quantity': 0, 'authorised_date': '2021-12-28 00:00:00', 'opening_quantity': 3, 'short_quantity': 0, 'collateral_quantity': 0, 'collateral_type': '', 'discrepancy': False, 'average_price': 582.666667, 'last_price': 539.8, 'close_price': 539.65, 'pnl': -128.60000100000002, 'day_change': 0.14999999999997726, 'day_change_percentage': 0.027795793569902208} ..... ```


نحوه نصب


نصب پکیج whl etag-cache-0.2:

    pip install etag-cache-0.2.whl


نصب پکیج tar.gz etag-cache-0.2:

    pip install etag-cache-0.2.tar.gz