Decorator to cache to Deta base
Project description
DetaCache
Async Function Decorator to cache to Deta base.
Installing
pip3 install DetaCache
Async
import asyncio
import aiohttp
from DetaCache import detaCache
from deta import Deta
db = Deta('project_key').Base("base_name")
@detaCache(dbCache=db,urlArg='url')
async def getjSON(url:str):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.json()
async def main():
data = await getjSON(url='https://httpbin.org/json')
print(data)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
License
MIT License
Copyright (c) 2021 Vidya Sagar
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
DetaCache-0.0.1.tar.gz
(2.3 kB
view hashes)