Skip to content

Commit

Permalink
Merge pull request #14 from lemeryfertitta/12-document-and-release-au…
Browse files Browse the repository at this point in the history
…rora-syncdownload

Add image downloading api for Aurora
  • Loading branch information
lemeryfertitta authored Dec 15, 2023
2 parents bf417a3 + a13178a commit 2f8c5f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "boardlib"
version = "0.2.0"
version = "0.3.0"
authors = [{ name = "Luke Emery-Fertitta", email = "[email protected]" }]
description = "Utilities for interacting with climbing board APIs"
readme = "README.md"
Expand Down
11 changes: 10 additions & 1 deletion src/boardlib/api/aurora.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def logbook_entries(board, username, password, grade_type="font"):
else boardlib.util.grades.FONT_TO_HUECO[font_grade]
),
"tries": attempt_id if attempt_id else raw_entry["bid_count"],
"is_mirror": raw_entry["is_mirror"]
"is_mirror": raw_entry["is_mirror"],
}


Expand All @@ -320,3 +320,12 @@ def gym_boards(board):
"latitude": gym["latitude"],
"longitude": gym["longitude"],
}


def download_image(board, image_filename, output_filename):
response = requests.get(
f"{API_HOSTS[board]}/img/{image_filename}",
)
response.raise_for_status()
with open(output_filename, "wb") as output_file:
output_file.write(response.content)

0 comments on commit 2f8c5f9

Please sign in to comment.