From: a.soldatof Date: Sat, 18 May 2019 23:29:14 +0000 (+0300) Subject: РАБОТАЕТ!!! X-Git-Url: https://git.xn--bdkaa.com/?a=commitdiff_plain;h=af3eacb43b2d3d958b1feb91e35d70f740fec8fd;p=where-are-you.py.git РАБОТАЕТ!!! --- 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