0

I'm calling google API from python requests, I'm able to get response from the API also able to extract status code if request is failing like 404. But how do I get success response as 200? I do not see any attribute with that status.

For example:

request = service.disks().get(project=project, zone=zone, disk=disk).execute()

response.status or response.status_code does not help.

accdias
5,3523 gold badges24 silver badges33 bronze badges
asked Jan 10, 2020 at 14:30
1
  • 1
    Are you really checking response.status or it was a typo and you meant to say request.status? Can you post a more complete code snippet? Commented Jan 10, 2020 at 14:34

1 Answer 1

2

The service.disks().get(project=project, zone=zone, disk=disk).execute() returns the dictionary.

Check the request['status'], it will return READY.

Document reference

answered Jan 10, 2020 at 14:55
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.