Bluemix提供的Weather Company Data
2017-05-02 本文已影响0人
灰太狼_black
IBM在收购了weather Company之后,在bluemix上提供了天气信息的数据API。我们首先在bluemix上建立一个WeatherCompany Data的service,通过如下代码访问API。

指定我们的API URL和检索的Params,就可以访问weather API了。
api='v3/location/search'
params = {'query':'Atlanta','locationType':'city','countryCode':'US','adminDistrictCode':'GA'}
weather = Weather(username='XXXXX',password='xxxxx',params=params,api_url=api)
print(dumps(weather.getWeather(),indent=2))