Use this tag if you are going to refer something from Python libraries OR API Clients of Google Cloud Platform.
Questions tagged [google-cloud-python]
207 questions
2
votes
1 answer
How to do a GQL query (using gcloud-python)
I have a collection of Entities of one kind. I need to extract the distinct values of one property, named p, of these Entities.
In GQL, I would do:
SELECT DISTINCT p from kind
However in the gcloud-python library GQL queries aren't implemented yet…

François Kawala
- 436
- 3
- 18
2
votes
2 answers
Connecting to Google Datastore using gcloud
I am trying to connect to my Google Datastore instance but I can't find any sample code for how to initialize a connection!
Gcloud's main documentation immediately starts with how to assign an Entity or a Query but skips the crucial connection bit.…

Moataz Elmasry
- 542
- 1
- 5
- 18
2
votes
1 answer
Appengine Blobstore: Index out of range
I'm trying to upload a file using Blobstore API to Google Cloud Storage. The image uploads correctly, but then I try to process it (link it to a user). I'm getting the error:
Index out of range
This is my code:
class…

Allan Porras
- 133
- 1
- 11
1
vote
1 answer
Set Iam Policy using Resource Manager Python V3 GCP API doesn't have a policy field?
I am trying to add service accounts to a certain role in a project in GCP. In order to do so, I get the IAM policy and then add the accounts desired, but am unable to get set_iam_policy to work correctly. I add the projects_to_add to the member list…

Anushka Vijay
- 13
- 3
1
vote
1 answer
use different project for bigquery data than for the billing of queries
I'm currently querying a project (call it data_project) in bigquery through the python SDK.
For several reasons I want to restrict the access to this project to a full read-only and switch the queries itself to another project (call it…

Nico Albers
- 1,556
- 1
- 15
- 32
1
vote
1 answer
Google Cloud SecretManagerServiceClient() is not finding creds with .from_service_account_json() file
Getting this error:
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please…

Zaffer
- 1,290
- 13
- 32
1
vote
1 answer
AttributeError: 'NoneType' object has no attribute 'format' - Google Cloud
I have such an erorr in Google Cloud: "AttributeError: 'NoneType' object has no attribute 'format'02:24".. Because of that my BQ table don't have any data inside. Can somebody help me? I am trying to implement Facebook Ads -> BQ connector…

kubri81
- 31
- 3
1
vote
3 answers
How to use GCP's ResourceManager Python client library to get all child Projects under a Folder?
v3 of the Cloud ResourceManager Python API has a list_projects method, but it only returns Projects that are direct children of the given Folder.
For example, you could have sub-folders of that main folder with their own projects and sub-folders and…

KJH
- 2,382
- 16
- 26
1
vote
1 answer
Using the Python API to read from Google Cloud Storage with minimal permissions
I would like to download blobs from a storage using Python. The examples show this code:
from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket(BUCKETNAME)
blob = bucket.get_blob(BLOBNAME)
raw_bytes =…

Boris Lau
- 55
- 1
- 9
1
vote
1 answer
How to retrieve delivery_attempt from event triggered cloud function?
I a writing a Python Cloud Function and I would like to retrieve the "delivery_attempt" attribute.
Based on the documentation, the Cloud Function gets only 2 parameters: event (of type PubsubMessage) and context.
def hello_pubsub(event, context):
…

poiuytrez
- 21,330
- 35
- 113
- 172
1
vote
0 answers
List Project specific Regions for Google Cloud via API
Is there any Google Cloud API which can be used to fetch project specific regions, instead of getting all regions where Google Cloud operates?
Currently, when I try to list using v1/projects/{project}/regions/list (Regions List API), it always…

Purusottam
- 611
- 6
- 19
1
vote
1 answer
403 Error while running cloudiot_pubsub_example_server.py code for GCP IOT Core and PUB/SUB
I am trying cloudiot_pubsub_example_server.py example code of GCP Python SDK. To give an overview there are two codes Client and Server. The client Publishes to a topic in GCP PUB/SUB and updates or publishes random temperature. The server…

Harsha Kada
- 13
- 3
1
vote
1 answer
How in Python do i use a GCP enum?
How do I use the GCP enum TextAnnotation.Types.DetectedBreak.Types.BreakType in my python code?
I assume I import it somehow, but do not know how.

schoon
- 2,858
- 3
- 46
- 78
1
vote
2 answers
Where can I find an older version of the documentation for an official Google Cloud Python library?
I am trying to find the documentation for the 0.39.0 version of the Google Cloud Vision Python library. This would help me to upgrade it to the latest 2.0.0 version, which has backwards incompatible changes.
The latest one can be found here:…

Tobi
- 904
- 1
- 8
- 29
1
vote
0 answers
Google Cloud Functions CI/CD for integration testing(Python)?
I am developing different Cloud Functions. Most of the functions have Google-Datastore, Pub/Sub and IoT external dependencies. I would like to run integration tests while deploying using cloudbuild.yaml.
I can test the unittest via pytest by having…

Hsn
- 1,168
- 2
- 16
- 39