kopia lustrzana https://github.com/glidernet/python-ogn-client
Add submodule ddb
rodzic
4f66218ef7
commit
763826953a
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Unreleased
|
||||
- aprs client: Added the possibility of a timed callback
|
||||
- Added ogn.ddb submodule which provides the generator `get_ddb_devices`
|
||||
|
||||
## 0.3.0 - 2016-03-18
|
||||
The repository ogn-python splitted up into two separate repositories:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from ogn.ddb.utils import get_ddb_devices # flake8: noqa
|
|
@ -0,0 +1,11 @@
|
|||
import requests
|
||||
|
||||
DDB_URL = "http://ddb.glidernet.org/download/?j=1"
|
||||
|
||||
|
||||
def get_ddb_devices():
|
||||
r = requests.get(DDB_URL)
|
||||
for device in r.json()['devices']:
|
||||
device.update({'identified': device['identified'] == 'Y',
|
||||
'tracked': device['tracked'] == 'Y'})
|
||||
yield device
|
|
@ -0,0 +1,10 @@
|
|||
import unittest
|
||||
|
||||
from ogn.ddb import get_ddb_devices
|
||||
|
||||
|
||||
class TestStringMethods(unittest.TestCase):
|
||||
def test_get_ddb_devices(self):
|
||||
devices = list(get_ddb_devices())
|
||||
self.assertGreater(len(devices), 4000)
|
||||
self.assertCountEqual(devices[0].keys(), ['device_type', 'device_id', 'aircraft_model', 'registration', 'cn', 'tracked', 'identified'])
|
Ładowanie…
Reference in New Issue