pywws.service.wetterarchivde

Upload weather data to wetter.com.

wetter.com is a web site gathering data mainly from stations in Germany. It’s referred to in pywws as wetterarchivde for historical reasons.

Classes

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

Bases: pywws.service.CatchupDataService

config = {'kennwort': ('', True, 'pwd'), 'user_id': ('', True, 'id')}
fixed_data = {'sid': 'pywws'}
interval = datetime.timedelta(seconds=300)
logger = <Logger pywws.service.wetterarchivde (WARNING)>
service_name = 'wetterarchivde'
template = '\n#live#\n#roundtime True#\n#idx "\'dtutc\': \'%Y%m%d%H%M\',"#\n#timezone local#\n#idx "\'dt\': \'%Y%m%d%H%M\',"#\n#hum_out "\'hu\': \'%.d\',"#\n#temp_out "\'te\': \'%.1f\',"#\n#rel_pressure "\'pr\': \'%.1f\',"#\n#wind_dir "\'wd\': \'%.0f\'," "" "winddir_degrees(x)"#\n#wind_ave "\'ws\': \'%.1f\',"#\n#wind_gust "\'wg\': \'%.1f\',"#\n#calc "rain_hour(data)" "\'pa\': \'%.1f\',"#\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.