Révision e216f1be
Plugin: weather_temp_: fix style issues
| plugins/weather/weather_temp_ | ||
|---|---|---|
| 22 | 22 |
re_DewC = re.compile('Dew.*\((-?\d+\.?\d?) C\)')
|
| 23 | 23 |
|
| 24 | 24 |
code = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
| 25 |
if code == None: sys.exit(1) |
|
| 26 | 25 |
|
| 27 |
if len(sys.argv) == 2 and sys.argv[1] == "autoconf": |
|
| 28 |
|
|
| 29 |
print "yes" |
|
| 30 | 26 |
|
| 27 |
if not code: |
|
| 28 |
sys.exit(1) |
|
| 29 |
elif len(sys.argv) == 2 and sys.argv[1] == "autoconf": |
|
| 30 |
print("yes")
|
|
| 31 | 31 |
elif len(sys.argv) == 2 and sys.argv[1] == "config": |
| 32 |
|
|
| 33 |
print 'graph_title Temperature and Dew Point at code %s' % code |
|
| 34 |
print 'graph_vlabel Temperature and Dew Point in C' |
|
| 35 |
print 'graph_category sensors' |
|
| 36 |
|
|
| 37 |
print 'temperature.label Temperature' |
|
| 38 |
print 'dewpoint.label Dew Point' |
|
| 39 |
|
|
| 40 |
print 'graph_args --base 1000 -l 0' |
|
| 41 |
|
|
| 32 |
print('graph_title Temperature and Dew Point at code %s' % code)
|
|
| 33 |
print('graph_vlabel Temperature and Dew Point in C')
|
|
| 34 |
print('graph_category sensors')
|
|
| 35 |
print('temperature.label Temperature')
|
|
| 36 |
print('dewpoint.label Dew Point')
|
|
| 37 |
print('graph_args --base 1000 -l 0')
|
|
| 42 | 38 |
else: |
| 43 |
|
|
| 44 |
u = urllib.urlopen(url % code) |
|
| 45 |
txt = u.read() |
|
| 46 |
u.close() |
|
| 47 |
|
|
| 48 |
C = re_C.findall(txt)[0] |
|
| 49 |
DewC = re_DewC.findall(txt)[0] |
|
| 50 |
|
|
| 51 |
print 'temperature.value %s' % C |
|
| 52 |
print 'dewpoint.value %s' % DewC |
|
| 53 |
|
|
| 39 |
u = urllib.urlopen(url % code) |
|
| 40 |
txt = u.read() |
|
| 41 |
u.close() |
|
| 42 |
|
|
| 43 |
C = re_C.findall(txt)[0] |
|
| 44 |
DewC = re_DewC.findall(txt)[0] |
|
| 45 |
print('temperature.value %s' % C)
|
|
| 46 |
print('dewpoint.value %s' % DewC)
|
|
Formats disponibles : Unified diff