这个项目代表了异步天气restapi的示例,它是使用quart(flask compatible API)pythonweb微框架基于Asyncio构建的
async-weather-api的Python项目详细描述
异步天气API
This project represents sample of asynchronous weather REST API that is build using quart (flask compatible API) python web microframework based on Asyncio.
工具
使用
PYPI
请运行以下脚本从PYPI获取最新包:
➜ pip install async-weather-api
然后请执行以下说明从您的环境启动游戏:
^{pr2}$Note
key
stands for API key from https://openweathermap.org
Docker图像
请运行下一个命令通过docker启动async weather api:
docker run -it -p 3000:5001 vyahello/async-weather-api:0.5.0 weather run --bind 0.0.0.0:5001 --mode prod --key <secret-key>
源代码
要运行源代码,请执行以下命令:
➜ python -m weather run --bind 0.0.0.0:5001 --mode prod --key your-secret-key Running on https://0.0.0.0:5001 (CTRL + C to quit) ...
终点
- /-主页
➜ curl -X GET http://0.0.0.0:5001/ ➜ curl -X GET http://0.0.0.0:5001/index
Response:html页面 - ^{str1}$/api/weather/{city}/{state}/{country}当前天气事件
➜ curl -X GET http://0.0.0.0:5001/api/events/London/GB/GreatBritain
Response:json对象{"city":"London","country":"GreatBritain","name":"Jeff the player","state":"GB"}
在 - /api/weather/{zip}/{country}-城市当前天气
➜ curl -X GET http://0.0.0.0:5001/api/weather/97002/us
Response:json对象{"base":"stations","clouds":{"all":90},"cod":200,"coord":{"lat":45.23,"lon":-122.8},...}
在 - /api/sun/{zip}/{country}-当前城市日落/日出
➜ curl -X GET http://0.0.0.0:5001/sun/weather/97002/us
Response:json对象{"astronomical_twilight_begin":"04:03:49 PM","astronomical_twilight_end":"04:29:50 AM",...}
在
开发说明
CI/CD
项目使用.travis.yml文件进行了Travis CI集成,因此代码分析(black
,mypy
,pydocstyle
,pylint
,flake8
)和单元测试(pytest
)将自动运行
每次对存储库进行更改后。在
为了能够运行代码分析,请执行以下命令:
➜ ./analyse-code.sh
另外,test-report.html
将在unittests执行后生成。在
除此之外,在使用pythonpublish.yml文件创建新标记后,将在PYPI上交付一个新版本的包。在
发行说明
- 0.5.0
- 添加官方形象
- 0.4.2款
- 添加清单包安装程序文件
- 0.4.1款
- 阅读PYPI构建要求
- 0.4.0
- 介绍PYPI包
- 0.3.0款
- 引入异步方法
- 0.2.0款
- 引入同步方法
- 0.1.0款
- 分发初始项目版本
Meta
作者——沃罗德米尔亚哈罗
以MIT
许可证分发。有关详细信息,请参见LICENSE。在
你可以联系我:
- vyahello@gmail.com
- https://github.com/vyahello
- https://www.linkedin.com/in/volodymyr-yahello-821746127
贡献
- 克隆存储库
- 使用
name
和email
进行克隆后首次配置Git pip install -r requirements.txt
安装所有项目依赖项pip install -r requirements-dev.txt
安装所有开发项目依赖项
- 项目
标签: