Skip to content

Commit

Permalink
Merge pull request #56 from PaulBoon/FixCallToraise_for_status_after_log
Browse files Browse the repository at this point in the history
Fixing call raise_for_status_after_log(r)()
  • Loading branch information
janvanmansum authored Apr 8, 2024
2 parents 22219ec + 9ff344f commit f7899ea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/datastation/dataverse/banner_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def list(self, dry_run: bool = False):
print(f"Would have sent the following request: {url}")
return
r = requests.get(url, headers=headers, params={'unblock-key': self.unblock_key})
raise_for_status_after_log(r)()
raise_for_status_after_log(r)
return r

def add(self, msg: str, dismissible_by_user: bool = False, lang: str = 'en', dry_run: bool = False):
Expand All @@ -41,7 +41,7 @@ def add(self, msg: str, dismissible_by_user: bool = False, lang: str = 'en', dry
print(json.dumps(banner, indent=4))
return
r = requests.post(url, headers=headers, params={'unblock-key': self.unblock_key}, json=banner)
raise_for_status_after_log(r)()
raise_for_status_after_log(r)
return r

def remove(self, banner_id: int, dry_run: bool = False):
Expand All @@ -52,5 +52,5 @@ def remove(self, banner_id: int, dry_run: bool = False):
print(f"Would have sent the following request: {url}")
return
r = requests.delete(url, headers=headers, params={'unblock-key': self.unblock_key})
raise_for_status_after_log(r)()
raise_for_status_after_log(r)
return r
2 changes: 1 addition & 1 deletion src/datastation/dataverse/dataverse_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_storage_size(self, dry_run=False):
return None
else:
r = requests.get(url, headers=headers)
raise_for_status_after_log(r)()
raise_for_status_after_log(r)
return r.json()['data']['message']

def add_role_assignment(self, assignee, role, dry_run=False):
Expand Down
2 changes: 1 addition & 1 deletion src/datastation/dataverse/file_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ def reingest(self, dry_run=False):
print_dry_run_message(method='POST', url=url, headers=headers, params=params)
return None
r = requests.post(url, headers=headers, params=params)
raise_for_status_after_log(r)()
raise_for_status_after_log(r)
return r
2 changes: 1 addition & 1 deletion src/datastation/dataverse/metrics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ def get_tree(self, dry_run: bool = False):
print(f"Would have sent the following request: {url}")
return
r = requests.get(url)
raise_for_status_after_log(r)()
raise_for_status_after_log(r)
return r.json()['data']

0 comments on commit f7899ea

Please sign in to comment.