diff options
| author | 2018-11-10 13:21:13 +0100 | |
|---|---|---|
| committer | 2018-11-10 13:21:13 +0100 | |
| commit | 6f6465ee1dfa5caa66d0fbc113b0c7994c1d3b68 (patch) | |
| tree | b9ab38dd62d6e1d8c10a77b96609ab116b790075 | |
| parent | Merge branch 'master' into django (diff) | |
Add `delete` and `post` API methods.
| -rw-r--r-- | bot/api.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bot/api.py b/bot/api.py index 6b9598da2..20522d154 100644 --- a/bot/api.py +++ b/bot/api.py @@ -28,3 +28,11 @@ class APIClient: async def get(self, endpoint: str, *args, **kwargs): async with self.session.get(self._url_for(endpoint), *args, **kwargs) as resp: return await resp.json() + + async def post(self, endpoint: str, *args. **kwargs): + async with self.session.post(self._url_for(endpoint), *args, **kwargs) as resp: + return await resp.json() + + async def delete(self, endpoint: str, *args. **kwargs): + async with self.session.delete(self._url_for(endpoint), *args, **kwargs) as resp: + return await resp.json() |