#NEWLINE# def handle_get_reseller( self , req ) : #NEWLINE# #INDENT# 'Handles the GET v2 call for getting general reseller information\n        (currently just a list of accounts). Can only be called by a\n        .reseller_admin.\n\n        On success, a JSON dictionary will be returned with a single `accounts`\n        key whose value is list of dicts. Each dict represents an account and\n        currently only contains the single key `name`. For example::\n\n            {"accounts": [{"name": "reseller"}, {"name": "test"},\n                          {"name": "test2"}]}\n\n        :param req: The swob.Request to process.\n        :returns: swob.Response, 2xx on success with a JSON dictionary as\n                  explained above.\n        ' #NEWLINE# if ( not self . is_reseller_admin ( req ) ) : #NEWLINE# #INDENT# return self . denied_response ( req ) #NEWLINE# #UNINDENT# listing = [ ] #NEWLINE# marker = '' #NEWLINE# while True : #NEWLINE# #INDENT# path = ( '/v1/%s?format=json&marker=%s' % ( quote ( self . auth_account ) , quote ( marker ) ) ) #NEWLINE# resp = self . make_pre_authed_request ( req . environ , 'GET' , path ) . get_response ( self . app ) #NEWLINE# if ( ( resp . status_int // 100 ) != 2 ) : #NEWLINE# #INDENT# raise Exception ( ( 'Could not list main auth account: %s %s' % ( path , resp . status ) ) ) #NEWLINE# #UNINDENT# sublisting = json . loads ( resp . body ) #NEWLINE# if ( not sublisting ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# for container in sublisting : #NEWLINE# #INDENT# if ( container [ 'name' ] [ 0 ] != '.' ) : #NEWLINE# #INDENT# listing . append ( { #NEWLINE# #INDENT# 'name' : container [ 'name' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# marker = sublisting [ ( - 1 ) ] [ 'name' ] . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# return Response ( body = json . dumps ( { #NEWLINE# #INDENT# 'accounts' : listing , #NEWLINE# #UNINDENT# } ) , content_type = CONTENT_TYPE_JSON )