]> git.xn--bdkaa.com Git - where-are-you.py.git/commitdiff
РАБОТАЕТ!!!
authora.soldatof <a.soldatof@gmail.com>
Sat, 18 May 2019 23:29:14 +0000 (02:29 +0300)
committera.soldatof <a.soldatof@gmail.com>
Sat, 18 May 2019 23:29:23 +0000 (02:29 +0300)
app.py

diff --git a/app.py b/app.py
index 2ac39936b6581443eba8c8c1d076f8a7741912e2..e7c9363c8122c0cdb6a323fcb789a19f3f939b73 100644 (file)
--- a/app.py
+++ b/app.py
@@ -202,14 +202,8 @@ def get_games():
                   games.values()]
     }
 
-
-@post('/api/games')
-@enable_cors
-def post_game():
+def handle_post_game(city_id):
     game_id = str(uuid.uuid4())
-
-    city_id = request.json['city'] or 'Екатеринбург'
-
     if city_id not in cities:
         return bottle.HTTPResponse(status=404, body='city not found')
 
@@ -232,6 +226,16 @@ def post_game():
         "max_lon": max_lon
     }
 
+@post('/api/games')
+@enable_cors
+def post_game_without_city():
+    return handle_post_game('Екатеринбург')
+
+@post('/api/games/<city>')
+@enable_cors
+def post_game(city):
+    return handle_post_game(city)
+
 
 @get('/api/games/<game_id>')
 @enable_cors