<s> import json <EOL> import os <EOL> import sys <EOL> import importlib <EOL> sys . path . append ( os . path . realpath ( '<STR_LIT>' ) ) <EOL> client_module = importlib . import_module ( '<STR_LIT>' ) <EOL> SampleUtilities = importlib . import_module ( '<STR_LIT>' ) <EOL> def main ( ) : <EOL> client = client_module . RestApiClient ( version = '<STR_LIT>' ) <EOL> SampleUtilities . pretty_print_request ( client , '<STR_LIT>' , '<STR_LIT:GET>' ) <EOL> response = client . call_api ( '<STR_LIT>' , '<STR_LIT:GET>' ) <EOL> if ( response . code != <NUM_LIT:200> ) : <EOL> print ( '<STR_LIT>' ) <EOL> SampleUtilities . pretty_print_response ( response ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> response_body = json . loads ( response . read ( ) . decode ( '<STR_LIT:utf-8>' ) ) <EOL> print ( '<STR_LIT>' + str ( len ( response_body ) ) ) <EOL> for server in response_body : <EOL> server_id = server [ '<STR_LIT>' ] <EOL> print ( '<STR_LIT>' . format ( server_id ) ) <EOL> print ( '<STR_LIT>' ) <EOL> endpoint = '<STR_LIT>' + str ( server_id ) + '<STR_LIT>' <EOL> SampleUtilities . pretty_print_request ( client , endpoint , '<STR_LIT:GET>' ) <EOL> response = client . call_api ( endpoint , '<STR_LIT:GET>' ) <EOL> if ( response . code != <NUM_LIT:200> ) : <EOL> print ( '<STR_LIT>' + str ( <EOL> server_id ) ) <EOL> SampleUtilities . pretty_print_response ( response ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> response_body = json . loads ( response . read ( ) . decode ( '<STR_LIT:utf-8>' ) ) <EOL> print ( json . dumps ( response_body , indent = <NUM_LIT:4> ) ) <EOL> proceed = input ( <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> if ( proceed != '<STR_LIT:Y>' ) : <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> ip = input ( <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> port = input ( <EOL> '<STR_LIT>' ) <EOL> protocol = input ( <EOL> '<STR_LIT>' ) <EOL> response_body . append ( { <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : protocol , <EOL> "<STR_LIT>" : port , <EOL> "<STR_LIT>" : ip <EOL> } ) <EOL> headers = { } <EOL> headers [ '<STR_LIT:Content-Type>' ] = '<STR_LIT:application/json>' <EOL> endpoint = '<STR_LIT>' + str ( server_id ) + '<STR_LIT>' <EOL> SampleUtilities . pretty_print_request ( <EOL> client , <EOL> endpoint , <EOL> '<STR_LIT>' , <EOL> headers = headers ) <EOL> response = client . call_api ( <EOL> endpoint , <EOL> '<STR_LIT>' , <EOL> headers = headers , <EOL> data = json . dumps ( response_body ) . encode ( ) ) <EOL> SampleUtilities . pretty_print_response ( response ) <EOL> if ( response . code != <NUM_LIT:200> ) : <EOL> print ( '<STR_LIT>' + str ( <EOL> server_id ) ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
