这个项目代表了异步天气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第三方库


热门话题
tomcat Java条带错误   java OPENTSDB fsck修复程序不更正重复点   java JavaFX在控制器内切换自身的可见性   java maven surefire插件未并行执行运行程序   读取导致Freemarker模板引擎中TemplateException的Java对象   无法使Java库与我的Android应用程序一起工作   安卓 java。lang.IllegalStateException游标   使用Java检索XML文件中的XSL URL和名称   java如何从文本文件集合中提取特定值   电子邮件java mail gmail   java为什么finalize()只被垃圾收集器调用一次?   java方法findViewById(int)对于Json类型是未定义的。蛇形   java在安卓中尝试从brother打印机打印位图时遇到以下异常   java在颤振中支持Kotlin的优势   java从后面编写文本   java制作列表。第一个列表可以有相同的数字,第二个将是价格,尝试制作第三个列表,如果它们是相同的数字,它将添加价格