[nominatim-web] Handle missing query params



commit 68ea8d0f7cdc5f5119fe5e4e1ae9d1c95030204c
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Fri Apr 2 14:48:29 2021 +0200

    Handle missing query params

 app/main.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/app/main.py b/app/main.py
index e5f37e9..2dac75f 100644
--- a/app/main.py
+++ b/app/main.py
@@ -47,10 +47,10 @@ def healthcheck():
 def search(request: Request):
     lang = request.query_params["accept-language"]
     limit = request.query_params["limit"]
-    country = request.query_params["country"]
-    state = request.query_params["state"]
-    city = request.query_params["city"]
-    street = request.query_params["street"]
+    country = request.query_params.get("country", "none")
+    state = request.query_params.get("state", "none")
+    city = request.query_params.get("city", "none")
+    street = request.query_params.get("street", "none")
 
     location = hashlib.md5(f"{country}:{state}:{city}:{street}".encode()).hexdigest()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]