Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
AstroPlasma test only on PR and report if data server communication fails
  • Loading branch information
dutta-alankar committed Apr 28, 2024
2 parents 106e5bf + ab071e8 commit 3158681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/AstroPlasma.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: AstroPlasma Unit tests

on:
workflow_dispatch:
pull_request:
push:
branches: '**'
branches: [main]

jobs:
python-env:
Expand Down
4 changes: 4 additions & 0 deletions astro_plasma/core/download_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
def fetch_list_from_url(link_list_url: str) -> List[str]:
# print(link_list_url)
response = requests.get(link_list_url, stream=True)
if response.status_code != 200:
sys.exit(f"Problem communicating with dataserver! (error code: {response.status_code}")
# print(response)
links = response.content.decode("utf-8").split("\n")
return links
Expand All @@ -33,6 +35,8 @@ def fetch_list_from_url(link_list_url: str) -> List[str]:
def get_filename(url: str) -> str:
try:
with requests.get(url, stream=True) as req:
if req.status_code != 200:
sys.exit(f"Problem communicating with dataserver! (error code: {req.status_code}")
if content_disposition := req.headers.get("Content-Disposition"):
param, options = werkzeug.http.parse_options_header(content_disposition)
if param == "attachment" and (filename := options.get("filename")):
Expand Down

0 comments on commit 3158681

Please sign in to comment.