2019-11-22 11:23:24 -07:00
|
|
|
"""SatNOGS Network django management command to fetch data (Satellites and Transmitters)"""
|
2019-12-30 13:32:04 -07:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2019-09-23 05:08:11 -06:00
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
2020-01-02 13:52:46 -07:00
|
|
|
# Remove this import after Python 3 migration
|
|
|
|
from requests.exceptions import ConnectionError # pylint: disable=W0622
|
2015-05-09 03:50:57 -06:00
|
|
|
|
2019-12-29 15:11:06 -07:00
|
|
|
from network.base.tasks import fetch_data
|
2015-05-09 03:50:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
2019-11-22 11:23:24 -07:00
|
|
|
"""Django management command to fetch Satellites and Transmitters from SatNOGS DB"""
|
|
|
|
help = 'Fetches Satellites and Transmitters from SaTNOGS DB'
|
2015-05-09 03:50:57 -06:00
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
try:
|
2019-12-29 15:11:06 -07:00
|
|
|
fetch_data()
|
|
|
|
except ConnectionError as exception:
|
|
|
|
raise CommandError(exception)
|