@@ -760,41 +760,51 @@ def repository(self, owner, repository):
760
760
json = self ._json (self ._get (url ), 200 )
761
761
return Repository (json , self ) if json else None
762
762
763
- def search_issues (self , owner , repo , state , keyword ):
763
+ def search_issues (self , owner , repo , state , keyword , start_page = 0 ):
764
764
"""Find issues by state and keyword.
765
765
766
766
:param str owner: (required)
767
767
:param str repo: (required)
768
768
:param str state: (required), accepted values: ('open', 'closed')
769
769
:param str keyword: (required), what to search for
770
+ :param int start_page: (optional), page to get (results come 100/page)
770
771
:returns: list of :class:`LegacyIssue <github3.legacy.LegacyIssue>`\ s
771
772
"""
773
+ params = {} if int (start_page ) > 0 else {'start_page' : int (start_page )}
772
774
url = self ._build_url ('legacy' , 'issues' , 'search' , owner , repo ,
773
775
state , keyword )
774
- json = self ._json (self ._get (url ), 200 )
776
+ json = self ._json (self ._get (url , params = params ), 200 )
775
777
issues = json .get ('issues' , [])
776
778
return [LegacyIssue (l , self ) for l in issues ]
777
779
778
- def search_repos (self , keyword , ** params ):
780
+ def search_repos (self , keyword , language = '' , start_page = 0 ):
779
781
"""Search all repositories by keyword.
780
782
781
783
:param str keyword: (required)
782
- :param dict params: (optional), filter by language and/or start_page
784
+ :param str language: (optional), language to filter by
785
+ :param int start_page: (optional), page to get (results come 100/page)
783
786
:returns: list of :class:`LegacyRepo <github3.legacy.LegacyRepo>`\ s
784
787
"""
785
788
url = self ._build_url ('legacy' , 'repos' , 'search' , keyword )
789
+ params = {}
790
+ if language :
791
+ params ['language' ] = language
792
+ if start_page > 0 :
793
+ params ['start_page' ] = start_page
786
794
json = self ._json (self ._get (url , params = params ), 200 )
787
795
repos = json .get ('repositories' , [])
788
796
return [LegacyRepo (r , self ) for r in repos ]
789
797
790
- def search_users (self , keyword ):
798
+ def search_users (self , keyword , start_page = 0 ):
791
799
"""Search all users by keyword.
792
800
793
801
:param str keyword: (required)
802
+ :param int start_page: (optional), page to get (results come 100/page)
794
803
:returns: list of :class:`LegacyUser <github3.legacy.LegacyUser>`\ s
795
804
"""
805
+ params = {} if int (start_page ) > 0 else {'start_page' : int (start_page )}
796
806
url = self ._build_url ('legacy' , 'user' , 'search' , str (keyword ))
797
- json = self ._json (self ._get (url ), 200 )
807
+ json = self ._json (self ._get (url , params = params ), 200 )
798
808
users = json .get ('users' , [])
799
809
return [LegacyUser (u , self ) for u in users ]
800
810
0 commit comments