diff --git a/README.md b/README.md index 5677347..a0217b0 100644 --- a/README.md +++ b/README.md @@ -65,23 +65,13 @@ pip install -r requirements.txt # Configure Configure thusly. -In the `upload` script, set the URL of the DB server to use. -Examples: - -Running your own local server: ``` -URL_API_BASE = "http://localhost:8000/api" +echo "no configuration ? :)" ``` -Using the LSF DB development server: -``` -URL_API_BASE = "https://db-dev.satnogs.org/api" -``` -Using the LSF DB live production server: -``` -URL_API_BASE = "https://db.satnogs.org/api" -``` +# Run +Run thusly. Gently use the development (testing) server to confirm scripts are behaving correctly, before uploading to the SatNOGS DB production server. @@ -90,31 +80,33 @@ Also, before uploading to the production server, it is probably a good idea to let the LSF admins know via the #satnogs-optical matrix channel. -Set the token to the API token from the server to use: -``` -TOKEN = "d111111111111112222222222222233333333345" -``` - -Note, the API `TOKEN` is different on the development `db-dev` server +Note, the API token is different on the development `db-dev` server and the production `db` server. -Set the filepaths to the location of the files to import. - +URL for running your own local server: ``` -JSON_FILEPATH = "examples/2023-06-25T03-56-23.189_data.json" -PLOT_FILEPATH = "examples/2023-06-25T03-56-23.189_0.png" +http://localhost:8000/api ``` +Using the LSF DB development server: +``` +https://db-dev.satnogs.org/api +``` -# Run -Run thusly. +Using the LSF DB live production server: +``` +https://db.satnogs.org/api +``` ``` cd satnogs-optical-scripts/ source env/bin/activate -./satnogs-optical-upload --json=examples/2023-06-25T03-56-23.189_data.json \ - --plot=examples/2023-06-25T03-56-23.189_0.png +./satnogs-optical-upload \ + --json=examples/2023-06-25T03-56-23.189_data.json \ + --plot=examples/2023-06-25T03-56-23.189_0.png \ + --token="d111111111111112222222222222233333333345" \ + --url="http://localhost:8000/api" ``` diff --git a/satnogs-optical-upload b/satnogs-optical-upload index 0c1c9e7..0068a0b 100755 --- a/satnogs-optical-upload +++ b/satnogs-optical-upload @@ -26,22 +26,19 @@ import json import requests import argparse -# Local SatNOGS DB server -URL_API_BASE = "http://localhost:8000/api" -# Libre Space Foundation SatNOGS DB development test server -#URL_API_BASE = "https://db-dev.satnogs.org/" -# Libre Space Foundation SatNOGS DB production server -#URL_API_BASE = "https://db.satnogs.org/" TIMEOUT = 3 -TOKEN = "" # Parse command line options parser = argparse.ArgumentParser() -parser.add_argument("-j", "--json", type=str, required=True) -parser.add_argument("-p", "--plot", type=str, required=True) +parser.add_argument("-j", "--json", help="JSON file from stvid", type=str, required=True) +parser.add_argument("-p", "--plot", help="PNG plot from stvid", type=str, required=True) +parser.add_argument("-t", "--token", help="DB API token", type=str, required=True) +parser.add_argument("-u", "--url", help="DB base URL", type=str, required=True) args = parser.parse_args() JSON_FILEPATH = args.json PLOT_FILEPATH = args.plot +TOKEN = args.token +URL_API_BASE = args.url def print_json(jsn):