Skip to content

Commit a5eb25b

Browse files
committed
Update year
1 parent 7344f76 commit a5eb25b

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017 Fabian Affolter <fabian@affolter-engineering.ch>
2+
Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
33
44
Licensed under MIT. All rights reserved.
55
"""
@@ -12,7 +12,7 @@
1212
@asyncio.coroutine
1313
def main():
1414
with aiohttp.ClientSession() as session:
15-
data = Luftdaten(2154, loop, session)
15+
data = Luftdaten(155, loop, session)
1616
yield from data.async_get_data()
1717

1818
# Print the sensor values

luftdaten/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017 Fabian Affolter <fabian@affolter-engineering.ch>
2+
Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
33
44
Licensed under MIT. All rights reserved.
55
"""
@@ -63,8 +63,12 @@ def async_get_data(self):
6363
_LOGGER.error("Can not load data from luftdaten.info")
6464
raise exceptions.LuftdatenConnectionError()
6565

66+
print(data)
6667
try:
67-
sensor_data = sorted(data, key=lambda timestamp: timestamp['timestamp'], reverse=True)[0]
68+
sensor_data = sorted(
69+
data, key=lambda timestamp: timestamp['timestamp'],
70+
reverse=True)[0]
71+
print(sensor_data)
6872
for entry in sensor_data['sensordatavalues']:
6973
for measurement in self.values.keys():
7074
if measurement == entry['value_type']:

luftdaten/exceptions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017 Fabian Affolter <fabian@affolter-engineering.ch>
2+
Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
33
44
Licensed under MIT. All rights reserved.
55
"""
@@ -15,3 +15,9 @@ class LuftdatenConnectionError(LuftdatenError):
1515
"""When a connection error is encountered."""
1616

1717
pass
18+
19+
20+
class LuftdatenNoDataAvailable(LuftdatenError):
21+
"""When no data is available."""
22+
23+
pass

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env python3
2+
"""
3+
Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
24
5+
Licensed under MIT. All rights reserved.
6+
"""
37
import os
48
import sys
59

@@ -21,7 +25,7 @@
2125
author='Fabian Affolter',
2226
author_email='fabian@affolter-engineering.ch',
2327
license='MIT',
24-
install_requires=['aiohttp'],
28+
install_requires=['aiohttp', 'async_timeout'],
2529
packages=['luftdaten'],
2630
zip_safe=True,
2731
classifiers=[

0 commit comments

Comments
 (0)