Adding features to find public toilets and shopping streets #41
| @@ -132,14 +132,6 @@ def get_landmark(landmark_uuid: str) -> Landmark: | |||||||
|     """ |     """ | ||||||
|     try: |     try: | ||||||
|         landmark = cache_client.get(f"landmark_{landmark_uuid}") |         landmark = cache_client.get(f"landmark_{landmark_uuid}") | ||||||
|         if not isinstance(landmark, Landmark) : |  | ||||||
|             raise HTTPException(status_code=500, detail=f"Object {landmark} is not of type Landmark") |  | ||||||
|         return landmark |         return landmark | ||||||
|     except KeyError as exc: |     except KeyError as exc: | ||||||
|         raise HTTPException(status_code=404, detail="Landmark not found") from exc |         raise HTTPException(status_code=404, detail="Landmark not found") from exc | ||||||
|     except ConnectionError as exc: |  | ||||||
|         raise HTTPException(status_code=503, detail="Service unavailable") from exc |  | ||||||
|     except TimeoutError as exc: |  | ||||||
|         raise HTTPException(status_code=504, detail="Request timed out") from exc |  | ||||||
|     except Exception as exc: |  | ||||||
|         raise HTTPException(status_code=500, detail="An unexpected error occurred") from exc |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| """Module used for handling cache""" | """Module used for handling cache""" | ||||||
|  | from pymemcache import serde | ||||||
| from pymemcache.client.base import Client | from pymemcache.client.base import Client | ||||||
|  |  | ||||||
| from .constants import MEMCACHED_HOST_PATH | from .constants import MEMCACHED_HOST_PATH | ||||||
| @@ -70,5 +70,6 @@ else: | |||||||
|         MEMCACHED_HOST_PATH, |         MEMCACHED_HOST_PATH, | ||||||
|         timeout=1, |         timeout=1, | ||||||
|         allow_unicode_keys=True, |         allow_unicode_keys=True, | ||||||
|         encoding='utf-8' |         encoding='utf-8',  | ||||||
|  |         serde=serde.pickle_serde | ||||||
|     ) |     ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user