Skip to content

Commit

Permalink
Merge pull request #1562 from materialsproject/dev
Browse files Browse the repository at this point in the history
client: fix delete_project
  • Loading branch information
tschaume authored May 12, 2023
2 parents fc06e0a + ce99a87 commit 83aebf0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,11 @@ def delete_project(self, name: str = None):
if not name:
raise MPContribsClientError("initialize client with project or set `name` argument!")

if not self.get_totals(query={"name": name}, resource="projects")[0]:
raise MPContribsClientError(f"Project `{name}` doesn't exist!")

resp = self.projects.deleteProjectByName(pk=name).result()
if "error" in resp:
if resp and "error" in resp:
raise MPContribsClientError(resp["error"])

def get_contribution(self, cid: str) -> Type[Dict]:
Expand Down

0 comments on commit 83aebf0

Please sign in to comment.