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

Commita18acfc

Browse files
committed
Add User.iter_keys
This API call now works, so let's add it to github3.py too. Sadly itdoes not return the key titles like github.iter_keys().
1 parent695c713 commita18acfc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎github3/users.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ def iter_following(self, number=-1):
215215
url=self._build_url('following',base_url=self._api)
216216
returnself._iter(int(number),url,User)
217217

218+
defiter_keys(self,number=-1):
219+
"""Iterate over the public keys of this user.
220+
221+
:param int number: (optional), number of keys to return. Default: -1
222+
returns all available keys
223+
:returns: generator of :class:`Key <Key>`\ s
224+
"""
225+
url=self._build_url('keys',base_url=self._api)
226+
returnself._iter(int(number),url,Key)
227+
218228
defiter_org_events(self,org,number=-1):
219229
"""Iterate over events as they appear on the user's organization
220230
dashboard. You must be authenticated to view this.

‎tests/test_users.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ def test_iter_subscriptions(self):
239239
github3.repos.Repository)
240240
self.mock_assertions()
241241

242+
deftest_iter_keys(self):
243+
expect(next(self.user.iter_keys(1))).isinstance(Key)
244+
242245
deftest_update(self):
243246
self.response('user',200)
244247
self.patch('https://api.github.com/user')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp