这个项目代表了异步天气restapi的示例,它是使用quart(flask compatible API)pythonweb微框架基于Asyncio构建的

async-weather-api的Python项目详细描述


made-with-pythonCode style: blackGitHub versionBuild StatusCoverage Status

ForksStarsIssuesGitHub watchersGitHub contributors

PyPI version shields.ioPyPI pyversions

Docker pullsLicense

异步天气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集成,因此代码分析(blackmypypydocstylepylintflake8)和单元测试(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。在

你可以联系我:

贡献

  1. 克隆存储库
  2. 使用nameemail进行克隆后首次配置Git
  3. pip install -r requirements.txt安装所有项目依赖项
  4. pip install -r requirements-dev.txt安装所有开发项目依赖项

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用java向dropup html/css添加项目   如何从java中的向量向量打印   Java Maven库项目模板   java使用atmosphere api还是直接使用grizzly?   java JComponent仅部分显示   如何将动态值传递给自定义注释,以从Java数据进行映射。性质   java破解已实现方法的返回类型的最佳方法?   java Netbeans在JFrame Gui布局中覆盖图像   spring java仅向登录用户显示注销按钮   java如何对com进行身份验证。谷歌。云bigquery。带有服务帐户的BigQuery`   java禁止空字符串参数和抛出RuntimeException以阻止方法继续的利弊   java分析项目中的所有JAR以获取版本和许可证信息   Java,数据库为什么要分配一个新对象,而我们可以直接将它放入数据库