Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
yassinsws committed Mar 31, 2024
1 parent 7211386 commit 0f57336
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/content_service/get_lecture_from_artemis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def download_lecture_pdf(base_url: str, unit_id: int) -> tempfile.NamedTemporary
artemis_url = f"{base_url}/api/v1/public/pyris/data/lecture-units/{unit_id}/pdf"
response = requests.get(artemis_url, stream=True)
if response.status_code != 200:
raise ConnectionError(f"Failed to download the file. Status code: {response.status_code}, URL: {artemis_url}")
raise ConnectionError(
f"Failed to download the file. Status code: {response.status_code}, URL: {artemis_url}"
)

with tempfile.NamedTemporaryFile() as temp_file:
for chunk in response.iter_content(chunk_size=DOWNLOAD_BUFFER_SIZE):
Expand Down

0 comments on commit 0f57336

Please sign in to comment.