(methodName)
return (methodName, methodNext)
Creates any _next methods for attaching to a Resource.

  The _next methods allow for easy iteration through list() responses.

  Args:
    methodName: string, name of the method to use.
Creates any _next methods for attaching to a Resource.
Creates any _next methods for attaching to a Resource .
def createNextMethod(methodName):
  """Creates any _next methods for attaching to a Resource.

  The _next methods allow for easy iteration through list() responses.

  Args:
    methodName: string, name of the method to use.
  """
  methodName = fix_method_name(methodName)

  def methodNext(self, previous_request, previous_response):
    """Retrieves the next page of results.

Args:
  previous_request: The request for the previous page. (required)
  previous_response: The response from the request for the previous page. (required)

Returns:
  A request object that you can call 'execute()' on to request the next
  page. Returns None if there are no more items in the collection.
    """
    # Retrieve nextPageToken from previous_response
    # Use as pageToken in previous_request to create new request.

    if 'nextPageToken' not in previous_response:
      return None

    request = copy.copy(previous_request)

    pageToken = previous_response['nextPageToken']
    parsed = list(urlparse.urlparse(request.uri))
    q = parse_qsl(parsed[4])

    # Find and remove old 'pageToken' value from URI
    newq = [(key, value) for (key, value) in q if key != 'pageToken']
    newq.append(('pageToken', pageToken))
    parsed[4] = urllib.urlencode(newq)
    uri = urlparse.urlunparse(parsed)

    request.uri = uri

    logger.info('URL being requested: %s' % uri)

    return request

  return (methodName, methodNext)
def createNextMethod ( methodName ) : methodName = fix_method_name ( methodName ) def methodNext ( self , previous_request , previous_response ) : """Retrieves the next page of results.

Args:
  previous_request: The request for the previous page. (required)
  previous_response: The response from the request for the previous page. (required)

Returns:
  A request object that you can call 'execute()' on to request the next
  page. Returns None if there are no more items in the collection.
    """ # Retrieve nextPageToken from previous_response # Use as pageToken in previous_request to create new request. if 'nextPageToken' not in previous_response : return None request = copy . copy ( previous_request ) pageToken = previous_response [ 'nextPageToken' ] parsed = list ( urlparse . urlparse ( request . uri ) ) q = parse_qsl ( parsed [ 4 ] ) # Find and remove old 'pageToken' value from URI newq = [ ( key , value ) for ( key , value ) in q if key != 'pageToken' ] newq . append ( ( 'pageToken' , pageToken ) ) parsed [ 4 ] = urllib . urlencode ( newq ) uri = urlparse . urlunparse ( parsed ) request . uri = uri logger . info ( 'URL being requested: %s' % uri ) return request return ( methodName , methodNext )