diff options
| author | 2019-12-21 11:16:07 -0800 | |
|---|---|---|
| committer | 2020-02-12 10:07:44 -0800 | |
| commit | 705963a2bf477b8536846683f9f2598ee788d3dc (patch) | |
| tree | 00c3271cd07d5c5b59667cfb6f13cba145eb6079 | |
| parent | Constants: add dev-core channel and check mark emoji (diff) | |
API: define functions with keyword-only arguments
This seems to have been the intent of the original implementation.
| -rw-r--r-- | bot/api.py | 20 | 
1 files changed, 10 insertions, 10 deletions
| diff --git a/bot/api.py b/bot/api.py index 56db99828..992499809 100644 --- a/bot/api.py +++ b/bot/api.py @@ -85,43 +85,43 @@ class APIClient:                  response_text = await response.text()                  raise ResponseCodeError(response=response, response_text=response_text) -    async def get(self, endpoint: str, *args, raise_for_status: bool = True, **kwargs) -> dict: +    async def get(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> dict:          """Site API GET."""          await self._ready.wait() -        async with self.session.get(self._url_for(endpoint), *args, **kwargs) as resp: +        async with self.session.get(self._url_for(endpoint), **kwargs) as resp:              await self.maybe_raise_for_status(resp, raise_for_status)              return await resp.json() -    async def patch(self, endpoint: str, *args, raise_for_status: bool = True, **kwargs) -> dict: +    async def patch(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> dict:          """Site API PATCH."""          await self._ready.wait() -        async with self.session.patch(self._url_for(endpoint), *args, **kwargs) as resp: +        async with self.session.patch(self._url_for(endpoint), **kwargs) as resp:              await self.maybe_raise_for_status(resp, raise_for_status)              return await resp.json() -    async def post(self, endpoint: str, *args, raise_for_status: bool = True, **kwargs) -> dict: +    async def post(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> dict:          """Site API POST."""          await self._ready.wait() -        async with self.session.post(self._url_for(endpoint), *args, **kwargs) as resp: +        async with self.session.post(self._url_for(endpoint), **kwargs) as resp:              await self.maybe_raise_for_status(resp, raise_for_status)              return await resp.json() -    async def put(self, endpoint: str, *args, raise_for_status: bool = True, **kwargs) -> dict: +    async def put(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> dict:          """Site API PUT."""          await self._ready.wait() -        async with self.session.put(self._url_for(endpoint), *args, **kwargs) as resp: +        async with self.session.put(self._url_for(endpoint), **kwargs) as resp:              await self.maybe_raise_for_status(resp, raise_for_status)              return await resp.json() -    async def delete(self, endpoint: str, *args, raise_for_status: bool = True, **kwargs) -> Optional[dict]: +    async def delete(self, endpoint: str, *, raise_for_status: bool = True, **kwargs) -> Optional[dict]:          """Site API DELETE."""          await self._ready.wait() -        async with self.session.delete(self._url_for(endpoint), *args, **kwargs) as resp: +        async with self.session.delete(self._url_for(endpoint), **kwargs) as resp:              if resp.status == 204:                  return None | 
