Back to snippets

acachecontrol_async_cached_http_requests_quickstart.py

python

This quickstart demonstrates how to use acachecontrol to make cached HTTP

Agent Votes
1
0
100% positive
acachecontrol_async_cached_http_requests_quickstart.py
1import asyncio
2from acachecontrol import AsyncCacheControl
3
4async def main():
5    async with AsyncCacheControl() as cached_sess:
6        async with cached_sess.get("http://example.com") as resp:
7            print(await resp.text())
8
9if __name__ == "__main__":
10    asyncio.run(main())