GithubHelp home page GithubHelp logo

srmchcy / chinaweather Goto Github PK

View Code? Open in Web Editor NEW

This project forked from numbbbbb/chinaweather

0.0 2.0 0.0 100 KB

获取**城市的实时天气状况

License: Do What The F*ck You Want To Public License

Python 100.00%

chinaweather's Introduction

ChinaWeather

  • 通过 BeautifulSoup 解析**气象网上的数据
  • 只支持Python2

安装

$ sudo pip install ChinaWeather

依赖

BeautifulSoup

支持城市列表

使用方法

首先获取城市天气的网址,方法是在所有城市中找到具体的城市,注意先选省再选市,一定要具体到市,确定网页上显示的是该市的气象信息,然后复制网站。

>>> import ChinaWeather
>>> print ChinaWeather.get('http://wap.weather.gov.cn/forecast/AAH/hefei.html')[u'天气']      # 注意输入是刚才复制的网址
多云
>>> print ChinaWeather.get('http://wap.weather.gov.cn/forecast/AAH/hefei.html')[u'气压']
1021hPa

返回值结构

  • 天气 —— 字符串;当前天气
  • 气压 —— 字符串:当前气压
  • 最新实况 —— 字符串;更新时间
  • 温度 —— 字符串;温度
  • 体感温度 —— 字符串;体感温度
  • 舒适感 —— 字符串;舒适感
  • 风向 —— 字符串;风向和风力
  • 相对湿度 —— 字符串;相对湿度

协议

基于WTFPL协议开源。

chinaweather's People

Watchers

James Cloos avatar HCY avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.