Skip to content

Commit 214c552

Browse files
committed
Add github3.search_users
- Also added links for text matching for user search
1 parent 3f728b1 commit 214c552

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

github3/api.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,58 @@ def search_repositories(query, sort=None, order=None, per_page=None,
463463
number, etag)
464464

465465

466+
def search_users(query, sort=None, order=None, per_page=None,
467+
text_match=False, number=-1, etag=None):
468+
"""Find users via the Search API.
469+
470+
.. warning::
471+
472+
You will only be able to make 5 calls with this or other search
473+
functions. To raise the rate-limit on this set of endpoints, create an
474+
authenticated :class:`GitHub <github3.github.GitHub>` Session with
475+
``login``.
476+
477+
The query can contain any combination of the following supported
478+
qualifers:
479+
480+
481+
- ``type`` With this qualifier you can restrict the search to just
482+
personal accounts or just organization accounts.
483+
- ``in`` Qualifies which fields are searched. With this qualifier you
484+
can restrict the search to just the username, public email, full
485+
name, or any combination of these.
486+
- ``repos`` Filters users based on the number of repositories they
487+
have.
488+
- ``location`` Filter users by the location indicated in their
489+
profile.
490+
- ``language`` Search for users that have repositories that match a
491+
certain language.
492+
- ``created`` Filter users based on when they joined.
493+
- ``followers`` Filter users based on the number of followers they
494+
have.
495+
496+
For more information about these qualifiers see: http://git.io/wjVYJw
497+
498+
:param str query: (required), a valid query as described above, e.g.,
499+
``tom repos:>42 followers:>1000``
500+
:param str sort: (optional), how the results should be sorted;
501+
options: ``followers``, ``repositories``, or ``joined``; default:
502+
best match
503+
:param str order: (optional), the direction of the sorted results,
504+
options: ``asc``, ``desc``; default: ``desc``
505+
:param int per_page: (optional)
506+
:param bool text_match: (optional), if True, return matching search
507+
terms. See http://git.io/_V1zRwa for more information
508+
:param int number: (optional), number of search results to return;
509+
Default: -1 returns all available
510+
:param str etag: (optional), ETag header value of the last request.
511+
:return: generator of :class:`UserSearchResult
512+
<github3.search.UserSearchResult>`
513+
"""
514+
return gh.search_users(query, sort, order, per_page, text_match, number,
515+
etag)
516+
517+
466518
def user(login):
467519
return gh.user(login)
468520
user.__doc__ = gh.user.__doc__

github3/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ def search_users(self, query, sort=None, order=None, per_page=None,
11371137
options: ``asc``, ``desc``; default: ``desc``
11381138
:param int per_page: (optional)
11391139
:param bool text_match: (optional), if True, return matching search
1140-
terms.
1140+
terms. See http://git.io/_V1zRwa for more information
11411141
:param int number: (optional), number of search results to return;
11421142
Default: -1 returns all available
11431143
:param str etag: (optional), ETag header value of the last request.

0 commit comments

Comments
 (0)