Reputation: 321
I want to query Google's AppEngine Admin API via the Python library to list a few things on my Google Cloud account. Lets take list services as an example:
You should be able to query the API with a link like this normally:
https://appengine.googleapis.com/v1/apps/{my-project}/services/services
But with the library you have to use the async function documented in this way: https://googleapis.dev/python/appengine/latest/appengine_admin_v1/services.html
async list_services(request:
Optional[Union[google.cloud.appengine_admin_v1.types.appengine.ListServicesRequest,
dict]] = None, *, retry: Union[google.api_core.retry.Retry, object] = <object object>,
timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ()) →
google.cloud.appengine_admin_v1.services.services.pagers.ListServicesAsyncPager[source]
Without an example this is hard to follow.
I've tried running it in my code like this:
return await google.cloud.appengine_admin.ServicesAsyncClient.list_services(
"https://appengine.googleapis.com/v1/apps/utility-destiny-325416/services/services"
)
But there seems to be missing parameters besides the url which makes it hard to gauge what's wrong - i get the error:
AttributeError: 'str' object has no attribute '_client'
Upvotes: 0
Views: 250
Reputation: 6263
A trick I usually follow is to go to the Github link for the library and look for tests. In your case, you should check out the Github Library link for test services.
Also see if this answer about cloud functions can help you figure out the url for services (I know they're different APIs but you might glean something from it)
Upvotes: 2