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

Commit4884c69

Browse files
committed
Add github3.search_repositories
1 parent22651d5 commit4884c69

File tree

1 file changed

+54
-5
lines changed

1 file changed

+54
-5
lines changed

‎github3/api.py

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,6 @@ def repository(owner, repository):
353353
repository.__doc__=gh.repository.__doc__
354354

355355

356-
defuser(login):
357-
returngh.user(login)
358-
user.__doc__=gh.user.__doc__
359-
360-
361356
defratelimit_remaining():
362357
"""Get the remaining number of requests allowed.
363358
@@ -367,6 +362,60 @@ def ratelimit_remaining():
367362
returngh.ratelimit_remaining
368363

369364

365+
defsearch_repositories(query,sort=None,order=None,per_page=None,
366+
text_match=False,number=-1,etag=None):
367+
"""Find repositories via various criteria.
368+
369+
.. warning::
370+
371+
You will only be able to make 5 calls with this or other search
372+
functions. To raise the rate-limit on this set of endpoints, create an
373+
authenticated :class:`GitHub <github3.github.GitHub>` Session with
374+
``login``.
375+
376+
The query can contain any combination of the following supported
377+
qualifers:
378+
379+
- ``in`` Qualifies which fields are searched. With this qualifier you
380+
can restrict the search to just the repository name, description,
381+
readme, or any combination of these.
382+
- ``size`` Finds repositories that match a certain size (in
383+
kilobytes).
384+
- ``forks`` Filters repositories based on the number of forks, and/or
385+
whether forked repositories should be included in the results at
386+
all.
387+
- ``created`` or ``pushed`` Filters repositories based on times of
388+
creation, or when they were last updated.
389+
- ``user`` or ``repo`` Limits searches to a specific user or
390+
repository.
391+
- ``language`` Searches repositories based on the language they're
392+
written in.
393+
- ``stars`` Searches repositories based on the number of stars.
394+
395+
:param str query: (required), a valid query as described above, e.g.,
396+
``tetris language:assembly``
397+
:param str sort: (optional), how the results should be sorted;
398+
options: ``stars``, ``forks``, ``updated``; default: best match
399+
:param str order: (optional), the direction of the sorted results,
400+
options: ``asc``, ``desc``; default: ``desc``
401+
:param int per_page: (optional)
402+
:param bool text_match: (optional), if True, return matching search
403+
terms. See http://git.io/4ct1eQ for more information
404+
:param int number: (optional), number of repositories to return.
405+
Default: -1, returns all available repositories
406+
:param str etag: (optional), previous ETag header value
407+
:return: dict
408+
"""
409+
returngh.search_repositories(query,sort,order,per_page,text_match,
410+
number,etag)
411+
# TODO Describe the dictionary being returned
412+
413+
414+
defuser(login):
415+
returngh.user(login)
416+
user.__doc__=gh.user.__doc__
417+
418+
370419
defzen():
371420
"""Return a quote from the Zen of GitHub. Yet another API Easter Egg.
372421

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp