Skip to content

Commit 6d4dee3

Browse files
committed
fix setup file bug + update readme + db data start
1 parent d3df319 commit 6d4dee3

File tree

12 files changed

+84
-31
lines changed

12 files changed

+84
-31
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
[![Known Vulnerabilities](https://snyk.io/test/github/deckbsd/glouton-satnogs-data-downloader/badge.svg)](https://snyk.io/test/github/deckbsd/glouton-satnogs-data-downloader)
22
# glouton-satnogs-data-downloader
3-
The console app is a downloader for the data provided by the satnogs network.
3+
This cli app is a downloader for the data provided by the satnogs network.
44

5-
command example :
5+
Installation :
6+
-------
7+
```
8+
python ./setup.py install
9+
```
10+
11+
Usage :
12+
-------
13+
14+
simple command example :
615
```
7-
python ./glouton.py -s 2018-01-20T00:51:54 -e 2018-01-21T00:51:54 -n 28654
16+
python ./bin/glouton -s 2018-01-20T00:51:54 -e 2018-01-21T00:51:54 -n 28654
817
```
918
command example if you just want the payload files :
1019
```
11-
python ./glouton.py -s 2018-01-20T00:51:54 -e 2018-01-21T00:51:54 -n 28654 --payload
20+
python ./bin/glouton -s 2018-01-20T00:51:54 -e 2018-01-21T00:51:54 -n 28654 --payload
1221
```
22+
command example if you want all data type from specific transmitter type, mode and uuid and apply module processing on waterfall :
1323
```
14-
python ./glouton.py -s 2019-05-09T00:51:54 -e 2019-05-30T00:51:54 -n 40069 --waterfallm TestModule,CSV --tuuid 8oBdHqMqgmMiWvRru6fWMn --ttype Transmitter --tmode LRPT
24+
python ./bin/glouton -s 2019-05-09T00:51:54 -e 2019-05-30T00:51:54 -n 40069 --waterfallm TestModule,CSV --tuuid 8oBdHqMqgmMiWvRru6fWMn --ttype Transmitter --tmode LRPT
1525
```
1626

1727
Actual features :
@@ -24,13 +34,19 @@ Actual features :
2434
* end date
2535
* stations
2636
* observation status
37+
* transmitter mode
38+
* transmitter uuid
39+
* transmitter type
40+
* vetted status
41+
* vetted user
2742
* working directory selection
2843
* Docker container
2944
* modules
3045

3146
Future :
3247
-------
3348
* automatic mode for downloading automatically the new observations of one or more satellites.
49+
* download data from satnogs db
3450

3551
Modules :
3652
-------

bin/glouton

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ if __name__ == "__main__":
3232
try:
3333
glouton()
3434
parser = argparse.ArgumentParser(description='Execute get request.')
35+
# Network API parameters :
3536
parser.add_argument('--norad', '-n', dest='norad_id', required='--last' not in sys.argv,
3637
help='the norad satellite id')
3738
parser.add_argument('--gsid', '-g', dest='ground_station_id',
3839
help='the ground station id')
3940
parser.add_argument('--status', '-t', dest='status',
4041
help='the Observation status (good, bad, unknown, failed')
41-
parser.add_argument('--sdate', '-s', dest='start_date', required='--last' not in sys.argv,
42+
parser.add_argument('--sdate', '-s', dest='start_date', required='--last' not in sys.argv and '--db' not in sys.argv,
4243
help='start date (ex: 2018-01-20T00:51:54)')
43-
parser.add_argument('--edate', '-e', dest='end_date', required='--last' not in sys.argv,
44+
parser.add_argument('--edate', '-e', dest='end_date', required='--last' not in sys.argv and '--db' not in sys.argv,
4445
help='end date (ex: 2018-01-21T00:51:54)')
4546
parser.add_argument('--user', '-u', dest='user_id',
4647
help='the user id')
@@ -68,6 +69,9 @@ if __name__ == "__main__":
6869
help='list of the modules to use while downloading waterfall separated by a ,')
6970
parser.add_argument('--last', dest='last', action='store_true',
7071
help='restart a download from the last command line.')
72+
# DB API parameters :
73+
parser.add_argument('--db', dest='db', action='store_true', default=False,
74+
help='download data from satnogs db api')
7175
args = parser.parse_args()
7276
session = SessionService()
7377
if args.last is True:
@@ -102,8 +106,10 @@ if __name__ == "__main__":
102106
args.transmitter_type)
103107
session.save_program_parameters(cmd)
104108

105-
obs = ObservationsService(cmd)
106-
obs.extract()
109+
if args.db is False:
110+
obs = ObservationsService(cmd)
111+
obs.extract()
112+
107113
logger.Info("\n\nall jobs are finished\t( ^ o^)\m/")
108114
except KeyboardInterrupt:
109115
print("Exit...")

glouton/commands/download/downloadCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from glouton.infrastructure.satnogClient import SatnogClient
1+
from glouton.infrastructure.satnogNetworkClient import SatnogNetworkClient
22
from glouton.commands.module.moduleCommandParams import ModuleCommandParams
33
from glouton.commands.module.moduleCommand import ModuleCommand
44
import os
55

66
class DownloadCommand:
77
def __init__(self, params, observation, modules_commands):
88
self.observation = observation
9-
self.client = SatnogClient()
9+
self.client = SatnogNetworkClient()
1010
self.full_path = os.path.join(params.working_dir, params.sub_folder)
1111
self.modules = params.modules
1212
self.modules_commands = modules_commands

glouton/commands/module/moduleCommand.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from glouton.infrastructure.satnogClient import SatnogClient
21
import os
32

43
class ModuleCommand:

glouton/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"DEFAULT": {
3-
"API_URL": "https://network.satnogs.org/api/",
3+
"NETWORK_API_URL": "https://network.satnogs.org/api/",
4+
"DB_API_URL": "https://db.satnogs.org/api/",
45
"HTTPS_PROXY": "",
56
"HTTP_PROXY": ""
67
},
78
"MODULES": {
89
"PAYLOAD": [],
910
"WATERFALL": [],
1011
"DEMODDATA": [],
12+
"FRAME": [],
1113
"FORALL": []
1214
},
1315
"LOGFILE": "gl.log"

glouton/infrastructure/satnogClient.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66
class SatnogClient:
77
def __init__(self):
8-
self._config = _config = config.read()
9-
self._url = _config['DEFAULT']['API_URL']
10-
self._proxies = self._set_proxy()
8+
self.config = config.read()
9+
self.proxies = self._set_proxy()
1110

1211
def _set_proxy(self):
1312
proxies = None
@@ -17,16 +16,16 @@ def _set_proxy(self):
1716
'https': os.environ['https_proxy']
1817
}
1918
return proxies
20-
if self._config['DEFAULT']['HTTP_PROXY'] != "" or self._config['DEFAULT']['HTTPS_PROXY'] != "":
19+
if self.config['DEFAULT']['HTTP_PROXY'] != "" or self.config['DEFAULT']['HTTPS_PROXY'] != "":
2120
proxies = {
22-
'http': self._config['DEFAULT']['HTTP_PROXY'],
23-
'https': self._config['DEFAULT']['HTTPS_PROXY']
21+
'http': self.config['DEFAULT']['HTTP_PROXY'],
22+
'https': self.config['DEFAULT']['HTTPS_PROXY']
2423
}
2524

2625
return proxies
2726

2827
def get(self, url, params=None):
29-
return requests.get(url, params=params, proxies=self._proxies)
28+
raise NotImplementedError()
3029

3130
def get_from_base(self, url, params=None):
32-
return requests.get(self._url + url, params=params, proxies=self._proxies)
31+
raise NotImplementedError()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from glouton.infrastructure.satnogClient import SatnogClient
2+
import os
3+
import requests
4+
5+
6+
class SatnogDbClient(SatnogClient):
7+
def __init__(self):
8+
SatnogClient.__init__(self)
9+
self._url = self.config['DEFAULT']['DB_API_URL']
10+
11+
def get(self, url, params=None):
12+
return requests.get(url, params=params, proxies=self.proxies)
13+
14+
def get_from_base(self, url, params=None):
15+
return requests.get(self._url + url, params=params, proxies=self.proxies)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from glouton.infrastructure.satnogClient import SatnogClient
2+
import os
3+
import requests
4+
5+
6+
class SatnogNetworkClient(SatnogClient):
7+
def __init__(self):
8+
SatnogClient.__init__(self)
9+
self._url = self.config['DEFAULT']['NETWORK_API_URL']
10+
11+
def get(self, url, params=None):
12+
return requests.get(url, params=params, proxies=self.proxies)
13+
14+
def get_from_base(self, url, params=None):
15+
return requests.get(self._url + url, params=params, proxies=self.proxies)

glouton/modules/moduleBase.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from glouton.infrastructure.satnogClient import SatnogClient
21
import os
32

43
class ModuleBase:

glouton/repositories/observation/observationsRepo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from queue import Queue
2-
from glouton.infrastructure.satnogClient import SatnogClient
2+
from glouton.infrastructure.satnogNetworkClient import SatnogNetworkClient
33
from glouton.shared.logger import logger
44

55

66
class ObservationRepo:
77
def __init__(self, cmd, repos):
88
self.OBSERVATION_URL = 'observations/'
9-
self.__client = SatnogClient()
9+
self.__client = SatnogNetworkClient()
1010
self.__repos = repos
1111
self.__cmd = cmd
1212
self.__threads = []

0 commit comments

Comments
 (0)