pywws.service.windy

Upload data to Windy.

Windy is a Czech company providing interactive weather forecasting services worldwide.

Note that you only need to specify your station ID if you have more than one station defined for your API. Windy allows other data, such as the latitude and longitude, to be included in the upload but it’s better to set these by editing your station at https://stations.windy.com/stations.

Classes

ToService(context[, check_params])
class pywws.service.windy.ToService(context, check_params=True)[source]

Bases: pywws.service.CatchupDataService

config = {'api_key': ('', True, None), 'station_id': ('', False, 'station')}
interval = datetime.timedelta(seconds=290)
logger = <Logger pywws.service.windy (WARNING)>
service_name = 'windy'
template = '\n#live#\n#idx "\'dateutc\' : \'%Y-%m-%d %H:%M:%S\',"#\n#wind_ave "\'wind\' : \'%.1f\',"#\n#wind_dir "\'winddir\' : \'%.0f\'," "" "winddir_degrees(x)"#\n#wind_gust "\'gust\' : \'%.2f\',"#\n#hum_out "\'humidity\' : \'%.d\',"#\n#temp_out "\'temp\' : \'%.1f\',"#\n#rel_pressure "\'mbar\' : \'%.1f\',"#\n#calc "dew_point(data[\'temp_out\'], data[\'hum_out\'])" "\'dewpoint\': \'%.1f\',"#\n#calc "rain_hour(data)" "\'precip\': \'%.2f\',"#\n'
session()[source]

Context manager factory function for a batch of one or more uploads.

This makes it easy to ensure any resources such as an internet connection are properly closed after a batch of uploads. Use the contextlib.contextmanager() decorator when you implement this method.

For a typical example, see the source code of the pywws.service.openweathermap module. If your upload can’t benefit from a session object yield None, as in pywws.service.copy.

upload_data(session, prepared_data={})[source]

Upload one data set to the service.

Every data service class must implement this method.

Parameters:
  • session (object) – the object created by session(). This is typically used to communicate with the server and is automatically closed when a batch of uploads has finished.
  • prepared_data (dict) – a set of key: value pairs to upload. The keys and values must all be text strings.

Comments or questions? Please subscribe to the pywws mailing list http://groups.google.com/group/pywws and let us know.