pywws.service.underground¶
Upload data to Weather Underground.
Weather Underground may be the oldest and best known site gathering data from amateur weather stations.
Create account: http://www.wunderground.com/members/signup.asp
API: http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol
Additional dependency: http://docs.python-requests.org/
Example
weather.ini
configuration:[underground] station = ABCDEFGH1 password = xxxxxxx internal = False [logged] services = ['underground', 'metoffice'] [live] services = ['underground', 'metoffice']
The internal
configuration setting allows you to include indoor
temperature and humidity in your uploads.
Previous versions of pywws had an extra underground_rf
service to
use Weather Underground’s “rapid fire” server for frequent uploads. Now
the rapid fire server is used automatically for “live” data and the
normal server for past data.
Classes
ToService (context[, check_params]) |
-
class
pywws.service.underground.
ToService
(context, check_params=True)[source]¶ Bases:
pywws.service.CatchupDataService
-
config
= {'internal': ('False', True, None), 'password': ('', True, 'PASSWORD'), 'station': ('', True, 'ID')}¶
-
fixed_data
= {'action': 'updateraw', 'softwaretype': 'pywws'}¶
-
interval
= datetime.timedelta(seconds=47)¶
-
logger
= <Logger pywws.service.underground (WARNING)>¶
-
service_name
= 'underground'¶
-
template
= '\n#live#\n#idx "\'dateutc\' : \'%Y-%m-%d %H:%M:%S\',"#\n#wind_dir "\'winddir\' : \'%.0f\'," "" "winddir_degrees(x)"#\n#wind_ave "\'windspeedmph\': \'%.2f\'," "" "wind_mph(x)"#\n#wind_gust "\'windgustmph\' : \'%.2f\'," "" "wind_mph(x)"#\n#hum_out "\'humidity\' : \'%.d\',"#\n#temp_out "\'tempf\' : \'%.1f\'," "" "temp_f(x)"#\n#rel_pressure "\'baromin\' : \'%.4f\'," "" "pressure_inhg(x)"#\n#calc "temp_f(dew_point(data[\'temp_out\'], data[\'hum_out\']))" "\'dewptf\': \'%.1f\',"#\n#calc "rain_inch(rain_hour(data))" "\'rainin\': \'%g\',"#\n#calc "rain_inch(rain_day(data))" "\'dailyrainin\': \'%g\',"#\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 yieldNone
, as inpywws.service.copy
.
-
Comments or questions? Please subscribe to the pywws mailing list http://groups.google.com/group/pywws and let us know.