Skip to content

Commit

Permalink
use the SP token passes as a console argument, otherwise use one from…
Browse files Browse the repository at this point in the history
… the env
  • Loading branch information
Theodlz committed Mar 14, 2024
1 parent 678a515 commit 7673daf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion frigate/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ def str_to_bool(value):
print("Getting candidates from SkyPortal using the following groupIDs:")
print(args.groupids)
candids_per_filter, err = get_candids_per_filter_from_skyportal(
args.start, args.end, args.groupids, args.filterids, saved=False
args.start,
args.end,
args.groupids,
args.filterids,
saved=False,
token=args.sp_token,
)
if err or candids_per_filter is None:
print(err)
Expand Down
7 changes: 5 additions & 2 deletions frigate/utils/skyportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ def get_skyportal_token():
raise ValueError(f"Failed to get SkyPortal token: {e}")


def get_candids_per_filter_from_skyportal(t_i, t_f, groupIDs, filterIDs, saved=False):
def get_candids_per_filter_from_skyportal(
t_i, t_f, groupIDs, filterIDs, saved=False, token=None
):
token = get_skyportal_token() if token is None else token
host = "https://fritz.science/api/candidates_filter"
headers = {"Authorization": f"token {get_skyportal_token()}"}
headers = {"Authorization": f"token {token}"}
# compute the isoformat of the start and end dates
start_date = Time(t_i, format="jd").iso
end_date = Time(t_f, format="jd").iso
Expand Down

0 comments on commit 7673daf

Please sign in to comment.