Weather API Lib
Project description
TimeWeather 0.1.0
安装方法
(python -m) pip install pyweather
使用方法
from pyweather import *
#QWFreeAPI 1-3三个和风天气开发版免费API
#LocateMe_China myip.ipip.net中国IP查询
#LocateMe和LocateMe_en myip.la国际IP查询
addr=LocateMe_China()
loc=QWFreeAPI1.locate(addr)
print(QWFreeAPI1.weather(loc))
函数
#将字符串转为整数
#获取字符串中第一个合法的整数
#123d -> 123
#asdf1234ghjk -> 1234
parse_int(s) -> int
#如果使用热点,定位可能失败,返回空字符串
#国内快速定位(https://www.ipip.net/myip.html)
LocateMe_China() -> str
#国际中文定位,稍慢(https://www.myip.la/)
LocateMe() -> str
#国际英文定位(https://www.myip.la/)
LocateMe_en() -> str
类
#天气
PointWeather(time=None,temp=None,feelslike=None,wea=None,weaicon=None,winddir=None,winddeg=None,windscale=None,windspeed=None,humidity=None,vis=None,aqi=None)
get_icon() -> bytes #获取天气图标
add(pw) -> None #添加天气数据,pw为另一个PointWeather对象
#可以使用str和repr
#和风天气API(不支持签名)
QWeatherAPI(key)
locate(loc) -> str #定位城市代码
weather(cid) -> PointWeather #根据城市代码查询天气
#免费开发版API:QWFreeAPI 1-3
#tianqiapi.com API
TianqiAPI(appid,appsecret)
weather(cid=None,city=None,ip=None) -> PointWeather #查询天气,默认查询本地天气
#免费API:TianqiFreeAPI
#心知天气API(只支持温度和天气种类,不支持签名)
SeniverseAPI(key)
weather(loc) -> PointWeather #根据城市查询天气
#免费API:SeniverseFreeAPI 1-3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timeweather-0.1.0.tar.gz
(3.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timeweather-0.1.0.tar.gz.
File metadata
- Download URL: timeweather-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
799206e64868d0bf93bdffe9b792296e9cbbb73c2f748f043c9cd3e346300f11
|
|
| MD5 |
7a4c687932cd29f5d3dc58938933892c
|
|
| BLAKE2b-256 |
85d5064929a8eab456f4d05a68dbb5e76f38ffc40eeda7088161ea378b73f0a3
|
File details
Details for the file timeweather-0.1.0-py3-none-any.whl.
File metadata
- Download URL: timeweather-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf4742309a27257a8f1d43b0a6cb2fd7c9528c4e322d0e51d986c278aaa40589
|
|
| MD5 |
fec89f58e4666d9d8db055b54fff7e03
|
|
| BLAKE2b-256 |
b03797e5580fa44cfd67f40f697ee5ed7a90064be36afdd8f90d0d4cfebe113f
|