-
Notifications
You must be signed in to change notification settings - Fork 0
/
metgis.py
64 lines (58 loc) · 1.84 KB
/
metgis.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import requests
# Make a get request to get the latest position of the international space station from the opennotify api.
key = "mD0yVm1yvZ8fdK3dibaZKprTz1rqNm13QECG2j40W4UgMaLB8"
lat = 30.7239
lon = 76.7896
alt = 1000
ver = "sum3"
url = "https://api.metgis.com/forecast?key="+key+"&lat="+(str)(lat)+"&lon="+(str)(lon)+"&alt="+(str)(alt)+"&v="+ver+"&lang=en"
response = requests.get(url)
sunrise = response.json().get('sunrise')
dayCount = response.json().get('dayCount')
weatherIcon = response.json().get('weatherIcon')
snowfall = response.json().get('snowfall')
unitLin = response.json().get('unitLin')
maxTemp = response.json().get('maxTemp')
description = response.json().get('description')
dateRequest = response.json().get('dateRequest')
windDir = response.json().get('windDir')
sunshineDuration = response.json().get('sumshineDuration')
precipitaton = response.json().get('precipitation')
windIcon = response.json().get('windIcon')
windSpeed = response.json().get('windSpeed')
lang = response.json().get('lang')
rainfall = response.json().get('rainfall')
unitWind = response.json().get('unitWind')
forecastIssued = response.json().get('forecastIssued')
minTemp = response.json().get('minTemp')
unitTemp = response.json().get('unitTemp')
sunset = response.json().get('sunset')
relativeHumidity = response.json().get('relativeHumidity')
forecastShortText = response.json().get('forecastShortText')
print(lat)
print(lon)
print(alt)
print(sunrise)
print(dayCount)
print(weatherIcon)
print(snowfall)
print(unitLin)
print(maxTemp)
print(description)
print(dateRequest)
print(windDir)
print(sunshineDuration)
print(precipitaton)
print(windIcon)
print(windSpeed)
print(lang)
print(rainfall)
print(unitWind)
print(forecastIssued)
print(minTemp)
print(unitTemp)
print(sunset)
print(relativeHumidity)
print(forecastShortText)
# print(response.content)
# print(response.headers)