If response code is not 200, then response.content will be an error message. The following code cannot parse this error message, and an exception will be thrown.
|
return {{ method.output.ident }}.from_json(response.content) |
Example response.content:
{\n"error": {\n "code": 403,\n "message": "Request is prohibited by organization\'s policy. vpcServiceControlsUniqueIdentifier: a69c658379e4178a",\n "errors": [\n {\n "message": "Request is prohibited by organization\'s policy. vpcServiceControlsUniqueIdentifier: a69c658379e4178a",\n "domain": "global",\n "reason": "forbidden"\n }\n ],\n "status": "PERMISSION_DENIED"\n }\n}
If response code is not 200, then
response.contentwill be an error message. The following code cannot parse this error message, and an exception will be thrown.gapic-generator-python/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2
Line 202 in 56c31de
Example
response.content:{\n"error": {\n "code": 403,\n "message": "Request is prohibited by organization\'s policy. vpcServiceControlsUniqueIdentifier: a69c658379e4178a",\n "errors": [\n {\n "message": "Request is prohibited by organization\'s policy. vpcServiceControlsUniqueIdentifier: a69c658379e4178a",\n "domain": "global",\n "reason": "forbidden"\n }\n ],\n "status": "PERMISSION_DENIED"\n }\n}