-
Notifications
You must be signed in to change notification settings - Fork 14
API returns "400 Request contains an invalid argument." #161
Comments
Hi, I'm not sure what's happening from the error message. It's possible there's additional information hidden in the error details (we're working on surfacing that information in googleapis/python-api-core#99). Could you pip install from google.rpc import error_details_pb2
from grpc_status import rpc_status
from google.cloud.securitycenter import SecurityCenterClient
< configure my credential args and organization_id>
client = SecurityCenterClient.from_service_account_info(info=credential_args)
org_name = "organizations/{org_id}".format(org_id=organization_id)
try:
asset_iterator = client.list_assets(request={"parent": org_name})
except GoogleAPICallError as rpc_error:
status = rpc_status.from_call(rpc_error.errors[0])
for detail in status.details:
if detail.Is(error_details_pb2.BadRequest.DESCRIPTOR):
info = error_details_pb2.BadRequest()
detail.Unpack(info)
print(info) |
Hi, Thank you for your advice!
client = SecurityCenterClient.from_service_account_info(info=credential_args)
org_name = "organizations/{org_id}".format(org_id=organization_id)
try:
asset_iterator = client.list_assets(request={"parent": org_name})
except GoogleAPICallError as rpc_error:
status = rpc_status.from_call(rpc_error.errors[0])
for detail in status.details:
if detail.Is(error_details_pb2.BadRequest.DESCRIPTOR):
info = error_details_pb2.BadRequest()
detail.Unpack(info)
print(info)
|
Ah it looks like there aren't any additional details to unpack. Thank you for trying that! One more question - could you try listing assets on a single project and see if that call succeeds? In the meantime I've filed an issue on the API team's issue tracker: https://issuetracker.google.com/issues/191040080. |
Really appreciate your support! Source : credential = service_account.Credentials.from_service_account_info(info=credential_args)
securitycenter_client = SecurityCenterClient.from_service_account_info(info=credential_args)
resource_client = resource_manager.Client(credentials=credential)
project_iterator = resource_client.list_projects()
for i, project in enumerate(project_iterator):
try:
print(f"Calling list_asset for {project.full_name}")
asset_iterator = securitycenter_client.list_assets(request={"parent": project.full_name})
except GoogleAPICallError as rpc_error:
print(rpc_error) Output
Please let me know if I can give more info for the investigation. |
Hi, I'm not sure why but today I confirmed my above code is working correctly. Thank you for your support and let me close this ticket. |
Edit (Solution) :
|
@marcdubois71450 Please open a new issue on the text-to-speech repository: https://github.com/googleapis/python-texttospeech with the information you provided and someone will get back to you. It's best to open new issues rather than commenting one closed issues as repository owners have better visibility into new issues. Thank you! |
In fact I just fixed with this:
This does not require issues, the error was in my code. Problème char :
|
Hi, I'm not sure this is bug but please allow me to file this issue.
Environment details
python --version
3.8.6pip --version
21.1.2google-cloud-securitycenter
version:pip show google-cloud-securitycenter
Steps to reproduce
Code example
This is almost same as given code on manual.
https://cloud.google.com/security-command-center/docs/how-to-api-list-assets?hl=ja
Below codes are works well. I've used this to make sure my credentials are valid,
When I input wrong organization_id, I got another error. so I've assumed my organization_id is correct.
Stack trace
The text was updated successfully, but these errors were encountered: