diff --git a/main.py b/main.py index 4640f23..98f86f9 100644 --- a/main.py +++ b/main.py @@ -35,7 +35,12 @@ def countries(): def monthly_average(country: str, city: str, month: str): return data[country][city][month] +# Create a new route that exposes the cities of a country: +@app.get('/countries/{country}') +def cities(country: str): + return list(data[country].keys()) + # Generate the OpenAPI schema: openapi_schema = app.openapi() with open(join(wellknown_path, "openapi.json"), "w") as f: - json.dump(openapi_schema, f) \ No newline at end of file + json.dump(openapi_schema, f)