work
This commit is contained in:
parent
5570e9de7c
commit
281d786c19
2 changed files with 41 additions and 35 deletions
11
py/api.py
11
py/api.py
|
@ -157,11 +157,12 @@ class API:
|
|||
|
||||
@self.app.route("/interstellar_ai/api/weather", methods=["POST"])
|
||||
def get_weather():
|
||||
unit_type = request.args.get("unit_type")
|
||||
city = request.args.get("city")
|
||||
return jsonify(
|
||||
{"status": 200, "response": self.weather.getweather(unit_type, city)}
|
||||
)
|
||||
sent_data = request.get_json()
|
||||
unit_type = sent_data.get("unit_type")
|
||||
city = sent_data.get("city")
|
||||
weather_data = self.weather.getweather(unit_type, city)
|
||||
print(type(weather_data))
|
||||
return jsonify({"status": 200, "response": weather_data})
|
||||
|
||||
self.app.run(debug=True, host="0.0.0.0", port=5000)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue