99from json import dumps
1010from requests import session
1111from github3 .auths import Authorization
12+ from github3 .decorators import requires_auth , requires_basic_auth
1213from github3 .events import Event
1314from github3 .gists import Gist
1415from github3 .issues import Issue , issue_params
1516from github3 .models import GitHubCore
1617from github3 .orgs import Organization
1718from github3 .repos import Repository
19+ from github3 .structs import SearchIterator
1820from github3 .users import User , Key
19- from github3 .decorators import requires_auth , requires_basic_auth
2021from github3 .notifications import Thread
2122from uritemplate import URITemplate
2223
@@ -985,7 +986,8 @@ def repository(self, owner, repository):
985986 return Repository (json , self ) if json else None
986987
987988 def search_repositories (self , query , sort = None , order = None ,
988- per_page = None , text_match = False ):
989+ per_page = None , text_match = False , number = - 1 ,
990+ etag = None ):
989991 """Find repositories via various criteria.
990992
991993 The query can contain any combination of the following supported
@@ -1016,6 +1018,9 @@ def search_repositories(self, query, sort=None, order=None,
10161018 :param int per_page: (optional)
10171019 :param bool text_match: (optional), if True, return matching search
10181020 terms. See http://git.io/4ct1eQ for more information
1021+ :param int number: (optional), number of repositories to return.
1022+ Default: -1, returns all available repositories
1023+ :param str etag: (optional), previous ETag header value
10191024 :return: dict
10201025 """
10211026 # TODO Describe the dictionary being returned
@@ -1034,12 +1039,7 @@ def search_repositories(self, query, sort=None, order=None,
10341039 }
10351040
10361041 url = self ._build_url ('search' , 'repositories' )
1037- results = self ._json (self ._get (url , params = params , headers = headers ),
1038- 200 )
1039- repos_dicts = results ['items' ]
1040- repos = [Repository (r ) for r in repos_dicts ]
1041- results ['repositories' ] = repos
1042- return results
1042+ return SearchIterator (number , url , Repository , self , params , etag )
10431043
10441044 def set_client_id (self , id , secret ):
10451045 """Allows the developer to set their client_id and client_secret for
0 commit comments