Skip to content
Snippets Groups Projects
Commit 985560b3 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

add request wrapper for PUT

parent 41a13664
Branches
Tags
No related merge requests found
...@@ -38,6 +38,19 @@ class Request(object): ...@@ -38,6 +38,19 @@ class Request(object):
except json.JSONDecodeError: except json.JSONDecodeError:
return None return None
def put(self, endpoint: str, headers=None, **kwargs):
r = requests.put(
self.BASE_URL + endpoint,
headers={**headers, **self.headers} if headers else self.headers,
**kwargs
)
r.raise_for_status()
try:
return r.json()
except json.JSONDecodeError:
return None
def delete(self, endpoint: str, headers=None, **kwargs): def delete(self, endpoint: str, headers=None, **kwargs):
r = requests.delete( r = requests.delete(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment