Question
Modify your program so that instead of printing the entire dictionary, response, it only prints the following, each on a separate line: user, operation type,
Modify your program so that instead of printing the entire dictionary, response, it only prints the following, each on a separate line: user, operation type, start date, start time
User name: instructor@.com Operation: stop Starting date: 2019-05-26 Starting time: 13:12:36.826-07:00
Since response is a dictionary, you access the elements like response['user']. Take a screenshot of the output of your program.
from pprint import pprint from googleapiclient import discovery from oauth2client.client import GoogleCredentials credentials = GoogleCredentials.get_application_default() service = discovery.build('compute', 'v1', credentials=credentials) # Project ID for this request. project = 'my-project' # TODO: Update placeholder value. # The name of the zone for this request. zone = 'my-zone' # TODO: Update placeholder value. # Name of the instance resource to stop. instance = 'my-instance' # TODO: Update placeholder value. request = service.instances().stop(project=project, zone=zone, instance=instance) response = request.execute() # TODO: Change code below to process the `response` dict: pprint(response)
I am not sure how to modify this above program using the instructions at the top of the page.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started