From af3eacb43b2d3d958b1feb91e35d70f740fec8fd Mon Sep 17 00:00:00 2001 From: "a.soldatof" Date: Sun, 19 May 2019 02:29:14 +0300 Subject: [PATCH] =?utf8?q?=D0=A0=D0=90=D0=91=D0=9E=D0=A2=D0=90=D0=95=D0=A2?= =?utf8?q?!!!?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 2ac3993..e7c9363 100644 --- 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/') +@enable_cors +def post_game(city): + return handle_post_game(city) + @get('/api/games/') @enable_cors -- 2.50.1