Decoupled credentials from argparse into configuration file
Signed-off-by: Pierros Papadeas <pierros@papadeas.gr>merge-requests/18/head
parent
02ec88ba03
commit
289bad05cb
|
@ -2,3 +2,4 @@
|
|||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
.env
|
||||
|
|
|
@ -10,6 +10,11 @@ SatNOGS network. It uses code from the SatNOGS network scheduler. It requires
|
|||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Copy the env-dist file to .env and set your legacy SatNOGS Network credentials.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
The following command will list all available command-line arguments:
|
||||
|
@ -19,4 +24,4 @@ The following command will list all available command-line arguments:
|
|||
|
||||
## License
|
||||
[![license](https://img.shields.io/badge/license-AGPL%203.0-6672D8.svg)](LICENSE)
|
||||
Copyright 2018 - Cees Bassa, Fabian Schmidt, Pierros Papadeas
|
||||
Copyright 2019 - Cees Bassa, Fabian Schmidt, Pierros Papadeas
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Copy this file to .env and complete the information needed
|
||||
|
||||
# Username and password to SatNOGS Network using the old authentication system
|
||||
NETWORK_USERNAME = ''
|
||||
NETWORK_PASSWORD = ''
|
|
@ -3,3 +3,4 @@ satellitetle>=0.5.0
|
|||
requests
|
||||
lxml
|
||||
tqdm
|
||||
python-decouple
|
||||
|
|
|
@ -90,9 +90,6 @@ def main():
|
|||
parser.add_argument("-w", "--wait",
|
||||
help="Wait time between consecutive observations (for setup and slewing)" +
|
||||
" [seconds; default: 0.0]", type=float, default=0)
|
||||
parser.add_argument("-u", "--username",
|
||||
help="old SatNOGS Network username (NOT the new Auth0 username)")
|
||||
parser.add_argument("-p", "--password", help="old SatNOGS Network password")
|
||||
parser.add_argument("-n", "--dryrun", help="Dry run (do not schedule passes)",
|
||||
action="store_true")
|
||||
parser.add_argument("-P", "--priorities", help="File with transmitter priorities. Should have" +
|
||||
|
@ -124,8 +121,6 @@ def main():
|
|||
if wait_time_seconds < 0:
|
||||
wait_time_seconds = 0.0
|
||||
cache_dir = "/tmp/cache"
|
||||
username = args.username
|
||||
password = args.password
|
||||
schedule = not args.dryrun
|
||||
search_transmitters = args.search_transmitters
|
||||
priority_filename = args.priorities
|
||||
|
@ -328,8 +323,8 @@ def main():
|
|||
login_hidden_inputs = login_html.xpath(
|
||||
r'//form//input[@type="hidden"]') # Get CSFR token
|
||||
form = {x.attrib["name"]: x.attrib["value"] for x in login_hidden_inputs}
|
||||
form["login"] = username
|
||||
form["password"] = password
|
||||
form["login"] = settings.NETWORK_USERNAME
|
||||
form["password"] = settings.NETWORK_PASSWORD
|
||||
|
||||
# Login
|
||||
result = session.post(loginUrl,
|
||||
|
|
15
settings.py
15
settings.py
|
@ -1,4 +1,11 @@
|
|||
DB_BASE_URL = 'https://db.satnogs.org'
|
||||
NETWORK_BASE_URL = 'https://network.satnogs.org'
|
||||
CACHE_AGE = 24
|
||||
MAX_NORAD_CAT_ID = 90000
|
||||
from decouple import config
|
||||
|
||||
# Basic settings
|
||||
DB_BASE_URL = config('DB_BASE_URL', default='https://db.satnogs.org')
|
||||
NETWORK_BASE_URL = config('NETWORK_BASE_URL', default='https://network.satnogs.org')
|
||||
CACHE_AGE = config('CACHE_AGE', default=24)
|
||||
MAX_NORAD_CAT_ID = config('CACHE_AGE', default=90000)
|
||||
|
||||
# Credentials
|
||||
NETWORK_USERNAME = config('NETWORK_USERNAME', default='')
|
||||
NETWORK_PASSWORD = config('NETWORK_PASSWORD', default='')
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
[metadata]
|
||||
name = satnogs-auto-scheduler
|
||||
url = https://gitlab.com/librespacefoundation/satnogs/satnogs-auto-scheduler
|
||||
author = SatNOGS project
|
||||
author_email = dev@satnogs.org
|
||||
license = AGPLv3
|
||||
classifiers =
|
||||
Development Status :: 4 - Beta
|
||||
Environment :: Console
|
||||
Intended Audience :: Telecommunications Industry
|
||||
Intended Audience :: Science/Research
|
||||
License :: OSI Approved :: GNU Affero General Public License v3
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3.7
|
||||
Topic :: Communications :: Ham Radio
|
||||
description = SatNOGS Auto Scheduler
|
||||
|
||||
[options]
|
||||
packages = find:
|
||||
include_package_data = True
|
||||
install_requires =
|
||||
# Basic
|
||||
requests
|
||||
lxml
|
||||
tqdm
|
||||
python-decouple
|
||||
# Astronomy
|
||||
satellitetle~=0.6.0
|
||||
ephem
|
||||
|
||||
[flake8]
|
||||
max-complexity = 25
|
||||
max-line-length = 100
|
||||
ignore = F403,W504
|
Loading…
Reference in New Issue