def createNextMethod(methodName):
 methodName = fix_method_name(methodName)
 def methodNext(self, previous_request, previous_response):
  "Retrieves the next page of results.\n\nArgs:\n  previous_request: The request for the previous page. (required)\n  previous_response: The response from the request for the previous page. (required)\n\nReturns:\n  A request object that you can call 'execute()' on to request the next\n  page. Returns None if there are no more items in the collection.\n    "
  if (('nextPageToken' not in previous_response) or (not previous_response['nextPageToken'])):
   return None
  request = copy.copy(previous_request)
  pageToken = previous_response['nextPageToken']
  parsed = list(urlparse(request.uri))
  q = parse_qsl(parsed[4])
  newq = [(key, value) for (key, value) in q if (key != 'pageToken')]
  newq.append(('pageToken', pageToken))
  parsed[4] = urlencode(newq)
  uri = urlunparse(parsed)
  request.uri = uri
  logger.info(('URL being requested: %s %s' % (methodName, uri)))
  return request
 return (methodName, methodNext)

def createNextMethod ( methodName ) : methodName = fix_method_name ( methodName ) def methodNext ( self , previous_request , previous_response ) : if ( ( 'nextPageToken' not in previous_response ) or ( not previous_response [ 'nextPageToken' ] ) ) : return None request = copy . copy ( previous_request ) pageToken = previous_response [ 'nextPageToken' ] parsed = list ( urlparse ( request . uri ) ) q = parse_qsl ( parsed [ 4 ] ) newq = [ ( key , value ) for ( key , value ) in q if ( key != 'pageToken' ) ] newq . append ( ( 'pageToken' , pageToken ) ) parsed [ 4 ] = urlencode ( newq ) uri = urlunparse ( parsed ) request . uri = uri logger . info ( ( 'URL being requested: %s %s' % ( methodName , uri ) ) ) return request return ( methodName , methodNext )
creates any _next methods for attaching to a resource .