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
1 Answer 1
The service.disks().get(project=project, zone=zone, disk=disk).execute() returns the dictionary.
Check the request['status'], it will return READY.
answered Jan 10, 2020 at 14:55
Vikram Shinde
1,0387 silver badges17 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py
response.statusor it was a typo and you meant to sayrequest.status? Can you post a more complete code snippet?