mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-18 15:05:08 +00:00
add url meth along with html_url
This commit is contained in:
parent
0f990d8434
commit
8c01855fff
2 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue