Skip to content

Commit

Permalink
use file jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
gferraro committed Mar 21, 2024
1 parent 9f5f492 commit 313f06c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion processing/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ def get_track_info(self, recording_id):
r = self.get(self.api_url + "/api/v1/recordings/{}/tracks".format(recording_id))
r.raise_for_status()
return r.json()


def get_rec(self, recording_id):
r = self.get(self.api_url + "/api/v1/recordings/{}".format(recording_id))
r.raise_for_status()
return r.json()

def download_file(self, token, filename):
r = requests.get(
urljoin(self.api_url, "/api/v1/signedUrl"),
Expand Down
3 changes: 3 additions & 0 deletions processing/trail_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def analyse_image(recording, jwtKey, conf):
r_id = recording["id"]
input_filename = temp_path / (f"recording-{r_id}" + input_extension)
logger.debug("downloading trail image to %s", input_filename)

# use file jwt as is smaller
jwtKey = api.get_rec(r_id)["downloadFileJWT"]
api.download_file(jwtKey, str(input_filename))
json_out = analyse(input_filename, conf, logger)
detections = json_out["images"][0].get("detections", [])
Expand Down

0 comments on commit 313f06c

Please sign in to comment.