diff --git a/github/http.py b/github/http.py index 18c8089..8cf193d 100644 --- a/github/http.py +++ b/github/http.py @@ -46,7 +46,7 @@ async def on_req_start( ) -> None: """Before-request hook to make sure we don't overrun the ratelimit.""" # print(repr(session), repr(ctx), repr(params)) - if session._rates.remaining in ('0', '1'): #type: ignore + if session._rates.remaining in ('0', '1'): # type: ignore raise Exception('Ratelimit exceeded') @@ -282,9 +282,7 @@ class http: data['files'][file.filename] = {'filename': file.filename, 'content': file.read()} # helps editing the file data = json.dumps(data) _headers = dict(self.session.headers) - result = await self.session.post( - CREATE_GIST_URL, data=data, headers=_headers - ) + result = await self.session.post(CREATE_GIST_URL, data=data, headers=_headers) if 201 == result.status: return await result.json() raise InvalidToken diff --git a/github/objects.py b/github/objects.py index 857960c..7fa6e37 100644 --- a/github/objects.py +++ b/github/objects.py @@ -460,6 +460,10 @@ class Gist(APIObject): """TODO: document this.""" return self._response + @property + def url(self) -> str: + return self._response.get('html_url') + async def delete(self): """Delete the gist.""" await self._http.delete_gist(self.id)