mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Finaly do a poor implementation of Github.get_gists
This commit is contained in:
@@ -382,6 +382,9 @@ class IntegrationTest:
|
||||
g.delete()
|
||||
self.printList( "Gists", u.get_gists(), lambda g: g.description )
|
||||
|
||||
def testGistsAll( self ):
|
||||
self.printList( "Gists", self.g.get_gists(), lambda g: g.description )
|
||||
|
||||
def testGitObjects( self ):
|
||||
o = self.g.get_organization( self.cobayeOrganization )
|
||||
r = o.get_repo( "TestPyGithub" )
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -22,3 +22,10 @@ class Github:
|
||||
|
||||
def get_gist( self, id ):
|
||||
return Gist( self, { "id": id }, lazy = False )
|
||||
|
||||
def get_gists( self ):
|
||||
return [
|
||||
Gist( self, attributes, lazy = True )
|
||||
for attributes
|
||||
in self._dataRequest( "GET", "/gists/public", None, None )
|
||||
]
|
||||
|
||||
+3
-1
@@ -17,7 +17,8 @@ class Requester:
|
||||
headers, output = self.__statusCheckedRequest( verb, url, parameters, input )
|
||||
|
||||
obviouslyFinished = False
|
||||
while "link" in headers and "next" in headers[ "link" ] and not obviouslyFinished:
|
||||
pageCount = 1
|
||||
while "link" in headers and "next" in headers[ "link" ] and not obviouslyFinished and pageCount < 10:
|
||||
for link in headers[ "link" ].split( "," ):
|
||||
if "next" in link:
|
||||
linkUrl = link.split( ";" )[ 0 ][ : -1 ]
|
||||
@@ -25,6 +26,7 @@ class Requester:
|
||||
parameters.update( dict( p.split( "=" ) for p in params.split( "&" ) ) )
|
||||
break
|
||||
headers, newOutput = self.__statusCheckedRequest( verb, url, parameters, input )
|
||||
pageCount += 1
|
||||
if len( newOutput ) == 0:
|
||||
obviouslyFinished = True
|
||||
output += newOutput
|
||||
|
||||
Reference in New Issue
Block a user