Sunrusojsis commited on
Commit
2473e73
·
verified ·
1 Parent(s): 7bb4d38

Removed Caching

Browse files
Files changed (1) hide show
  1. main.py +9 -8
main.py CHANGED
@@ -2,7 +2,7 @@ from fastapi import FastAPI, Request, HTTPException
2
  from fastapi.responses import Response
3
  import aiohttp
4
  from urllib.parse import urlparse
5
- from aiohttp_client_cache import CachedSession,CacheBackend
6
 
7
  app = FastAPI()
8
 
@@ -11,14 +11,15 @@ app = FastAPI()
11
 
12
  @app.on_event("startup")
13
  async def startup_event():
14
- cache = CacheBackend(
15
- allowed_methods=('GET', 'POST'),
16
- allowed_codes=(200,503,502),
17
- include_headers=True,
18
- expire_after = 20
19
- )
20
  global http_client
21
- http_client = CachedSession(cache=cache)
 
22
 
23
  @app.on_event("shutdown")
24
  async def shutdown_event():
 
2
  from fastapi.responses import Response
3
  import aiohttp
4
  from urllib.parse import urlparse
5
+ #from aiohttp_client_cache import CachedSession,CacheBackend
6
 
7
  app = FastAPI()
8
 
 
11
 
12
  @app.on_event("startup")
13
  async def startup_event():
14
+ # cache = CacheBackend(
15
+ # allowed_methods=('GET', 'POST'),
16
+ # allowed_codes=(200,503,502),
17
+ # include_headers=True,
18
+ # expire_after = 20
19
+ # )
20
  global http_client
21
+ http_client = aiohttp.ClientSession()
22
+ # http_client = CachedSession(cache=cache)
23
 
24
  @app.on_event("shutdown")
25
  async def shutdown_event():