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

Commitabaf927

Browse files
committed
Add GitHub#revoke_authorizations
1 parent2145262 commitabaf927

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

‎github3/github.py

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

1025+
defrevoke_authorizations(self,client_id):
1026+
"""Revoke all authorizations 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+
:returns: bool -- True if successful, False otherwise
1032+
"""
1033+
url=self._build_url('applications',str(client_id),'tokens')
1034+
returnself._boolean(self._delete(url),204,404)
1035+
10251036
defsearch_code(self,query,sort=None,order=None,per_page=None,
10261037
text_match=False,number=-1,etag=None):
10271038
"""Find code via the code search API.

‎tests/unit/test_github.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ def test_two_factor_login(self):
1414
deftest_can_login_without_two_factor_callback(self):
1515
self.instance.login('username','password')
1616
self.instance.login(token='token')
17+
18+
deftest_revoke_authorizations(self):
19+
self.instance.revoke_authorizations('client_id')
20+
self.session.delete.assert_called_once_with(
21+
'https://api.github.com/applications/client_id/tokens'
22+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp