30 lines
625 B
Python
30 lines
625 B
Python
from fastapi import FastAPI
|
|
import uvicorn
|
|
from src.utils.Log import Log
|
|
|
|
app = FastAPI(title="yin_home文档")
|
|
|
|
|
|
@app.get('/weather', tags=["获取天气数据"], summary="返回实时天气数据")
|
|
def weather():
|
|
return {
|
|
"code": 200,
|
|
"data": {
|
|
"city": "上海",
|
|
"weather": "多云",
|
|
"temperature": "25",
|
|
"wind": "南风",
|
|
"humidity": "60",
|
|
"pressure": "1010",
|
|
"update_time": "2021-09-01 12:00:00"
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
uvicorn.run(app='main:app', host='0.0.0.0', port=1314, reload=True)
|