Skip to content

Commit 9b19b98

Browse files
author
Charles Larivier
committed
docs: expand docstring for UpdateResource.update()
1 parent 5be1d1b commit 9b19b98

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

metabase/resource.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ def create(cls, **kwargs):
5858
"""Create an instance and save it."""
5959
response = cls.connection().post(cls.ENDPOINT, json=kwargs)
6060

61-
if response.status_code != 200:
61+
if response.status_code not in (200, 202):
6262
raise HTTPError(response.content.decode())
6363

6464
return cls(**response.json())
6565

6666

6767
class UpdateResource(Resource):
6868
def update(self, **kwargs) -> None:
69-
"""Update an instance."""
69+
"""
70+
Update an instance by providing function arguments.
71+
Providing any argument with metabase.MISSING will result in this argument being
72+
ignored from the request.
73+
"""
7074
params = {k: v for k, v in kwargs.items() if v != MISSING}
7175
response = self.connection().put(self.ENDPOINT + f"/{getattr(self, self.PRIMARY_KEY)}", json=params)
7276

0 commit comments

Comments
 (0)