-
Notifications
You must be signed in to change notification settings - Fork 14
/
example.py
39 lines (30 loc) · 1.03 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#-*- encoding: utf-8 -*-
import json
from openair import air_class
air = air_class.airChina()
# Get data of all air matters from each station in China
allData = air.getAllStationsData()
print json.dumps(allData[0])
# Get data of all substations in one province
# type search by
# 0 pid
# 1 Chinese name
# 2 Chinese pinyin
provinceData = air.getProvinceStationsData("shanghai", type=2)
print json.dumps(provinceData)
# Get all province names
AllProvince = air.getAllProvinceName()
print json.dumps(AllProvince)
# Get all cities of the province(pid)
AllCity = air.getProvinceAllCityName(12)
print json.dumps(AllCity)
# Get all stations of the province(pid)
AllProvinceStation = air.getProvinceAllStationInfo(10)
print json.dumps(AllProvinceStation)
# Get all stations of the city(pid & city name)
AllCityStation = air.getCityAllStationInfo(10, u"苏州市")
print json.dumps(AllCityStation)
# Get city AQI history
# param: city name or city code
cityHistory = air.getCityHistory(u"上海市")
print json.dumps(cityHistory)