Skip to content

Commit 1736d46

Browse files
Yuri ZmytrakovYuri Zmytrakov
authored andcommitted
add redis
1 parent b87e9c0 commit 1736d46

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

stac_fastapi/core/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"pygeofilter~=0.3.1",
2020
"jsonschema~=4.0.0",
2121
"slowapi~=0.1.9",
22+
"redis==6.4.0",
2223
]
2324

2425
setup(

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
add_previous_link,
2929
cache_current_url,
3030
cache_previous_url,
31-
connect_redis_sentinel,
3231
connect_redis,
3332
)
3433
from stac_fastapi.core.serializers import CollectionSerializer, ItemSerializer
@@ -248,7 +247,7 @@ async def all_collections(self, **kwargs) -> stac_types.Collections:
248247
redis = None
249248
try:
250249
redis = await connect_redis()
251-
except Exception as e:
250+
except Exception:
252251
redis = None
253252

254253
collections, next_token = await self.database.get_all_collections(
@@ -265,9 +264,7 @@ async def all_collections(self, **kwargs) -> stac_types.Collections:
265264
},
266265
]
267266

268-
await add_previous_link(
269-
redis, links, "collections", current_url, token
270-
)
267+
await add_previous_link(redis, links, "collections", current_url, token)
271268
if redis:
272269
await cache_previous_url(redis, current_url, "collections")
273270

@@ -303,7 +300,6 @@ async def get_collection(
303300
async def item_collection(
304301
self,
305302
collection_id: str,
306-
request: Request,
307303
bbox: Optional[BBox] = None,
308304
datetime: Optional[str] = None,
309305
limit: Optional[int] = None,
@@ -350,7 +346,7 @@ async def item_collection(
350346

351347
try:
352348
redis = await connect_redis()
353-
except Exception as e:
349+
except Exception:
354350
redis = None
355351

356352
if redis:
@@ -568,7 +564,7 @@ async def post_search(
568564
current_url = str(request.url)
569565
try:
570566
redis = await connect_redis()
571-
except Exception as e:
567+
except Exception:
572568
redis = None
573569

574570
if redis:

stac_fastapi/core/stac_fastapi/core/redis_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def connect_redis_sentinel(
9191

9292
redis_pool = master
9393

94-
except:
94+
except Exception:
9595
return None
9696

9797
return redis_pool

stac_fastapi/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import pytest
88
import pytest_asyncio
9+
import redis # noqa: F401
910
from fastapi import Depends, HTTPException, security, status
1011
from httpx import ASGITransport, AsyncClient
1112
from pydantic import ConfigDict

0 commit comments

Comments
 (0)