헤드 OpenWeather을 통해 자신에게 API 키를 얻을.
This URL에는 모든 도시의 목록이 있습니다. 여러 항목이 있습니다. 나는이 URL을 인터넷 검색 및 공격에 의해 샌프란시스코 (5391959) 발견 :
http://openweathermap.org/city/5391959?utm_source=openweathermap&utm_medium=widget&utm_campaign=html_old
...
이있는 나는
5391959
도시 ID를 추출 하였다. 당신의 API 키와 도시 ID로 무장
, 당신은 JSON 형식으로 날씨를 얻기 위해 다음과 같은 두 가지 명령을 사용할 수 있습니다
$weather = Invoke-WebRequest -Uri 'api.openweathermap.org/data/2.5/weather?id=5391959&APPID=YOUR_API_KEY_HERE'
$weatherObject = $weather.Content | ConvertFrom-Json
$weatherObject # display to console
이 ... 이런 식으로, 당신에게 객체를 줄 것이다 :
를
coord : @{lon=-122.42; lat=37.77}
weather : {@{id=804; main=Clouds; description=overcast clouds; icon=04n}}
base : stations
main : @{temp=285.91; pressure=1017; humidity=93; temp_min=283.15; temp_max=288.15}
visibility : 16093
wind : @{speed=4.6; deg=240}
clouds : @{all=90}
dt : 1489134900
sys : @{type=1; id=226; message=0.1525; country=US; sunrise=1489156026; sunset=1489198372}
id : 5391959
name : San Francisco
cod : 200
OpenWeatherAPI는 어떻습니까? 예를 들어 여기를 참조하십시오 : http://www.powershelladmin.com/wiki/Get-Weather_cmdlet_for_PowerShell,_using_the_OpenWeatherMap_API –
감사. 이 사이트를 알고 있지만 기본 기능을 사용하고 싶습니다. – LaPhi