Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42ce39e

Browse files
committed
Add GitHub#revoke_authorization
1 parentabaf927 commit42ce39e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎github3/github.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,19 @@ def repository(self, owner, repository):
10221022
json=self._json(self._get(url),200)
10231023
returnRepository(json,self)ifjsonelseNone
10241024

1025+
defrevoke_authorization(self,client_id,access_token):
1026+
"""Revoke specified authorization for an OAuth application.
1027+
1028+
Revoke all authorization tokens created by your application.
1029+
1030+
:param str client_id: (required), the client_id of your application
1031+
:param str acess_token: (required), the access_token to revoke
1032+
:returns: bool -- True if successful, False otherwise
1033+
"""
1034+
url=self._build_url('applications',str(client_id),'tokens',
1035+
str(access_token))
1036+
returnself._boolean(self._delete(url),204,404)
1037+
10251038
defrevoke_authorizations(self,client_id):
10261039
"""Revoke all authorizations for an OAuth application.
10271040

‎tests/unit/test_github.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ def test_can_login_without_two_factor_callback(self):
1515
self.instance.login('username','password')
1616
self.instance.login(token='token')
1717

18+
deftest_revoke_authorization(self):
19+
self.instance.revoke_authorization('client_id','access_token')
20+
self.session.delete.assert_called_once_with(
21+
'https://api.github.com/applications/client_id/tokens/access_token'
22+
)
23+
1824
deftest_revoke_authorizations(self):
1925
self.instance.revoke_authorizations('client_id')
2026
self.session.delete.assert_called_once_with(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp