Questions tagged [google-cloud-python]

Use this tag if you are going to refer something from Python libraries OR API Clients of Google Cloud Platform.

207 questions
7
votes
3 answers

Difficulty comparing generated and google cloud storage provided CRC32c checksums

I am attemptting to get a CRC32c checksum on my local file so I can compare it to the blob.crc32c provided by the gcloud library. Google says I should be using the crcmod module in order to actually calculate CRC32c hashes of my data.…
6
votes
2 answers

How to get the blob size of Cloud Storage object?

I could get the size from gsutil. ✗ gsutil du gs:///test/1561402306 100 gs:///test/1561402306 I could confirm the length and content via download_as_string. However, the size property always returns None from SDK/API. How…
6
votes
1 answer

Permission to Google Cloud Storage via service account in Python

I am trying to get a service account to create blobs in Google Cloud Storage from within a Python script, but I am having issues with the credentials. 1) I create the service account for my project and then download the key file in…
Mike
  • 3,775
  • 8
  • 39
  • 79
6
votes
5 answers

Using Python to Query GCP Stackdriver logs

I am using Python3 to query Stackdriver for GCP logs. Unfortunately, the log entries that have important data are returned to me as "NoneType" instead of as a "dict" or a "str". The resulting "entry.payload" is type "None" and the "entry.payload_pb"…
6
votes
1 answer

Google Cloud Datastore timeout errors in python

I have a table in Google Cloud Datastore where I store a small data structure which is written in one Python service and read in another. I am using gcloud version 0.15.0. Here is the Python code that I use to write/read data to/from GCD: from…
5
votes
3 answers

`vendor.add` doesn't expose dependencies to dev_appserver.py

Migrating a legacy project from 2.7 and Ubuntu 18.04 [piecemeal, Python 3.10 & 22.04 next… then Flask!] from vendored dependencies to requirements.txt. Removed dependencies from project root and enumerated them in my requirements.txt. My…
5
votes
0 answers

google-speech-api and getting speech contexts to be effective

I have set up a synchronous recognition script in Python that is working as expected to return the transcript of various audio files that I send to the Google Speech API. However, I can't seem to get the speech context hints (speech_contexts in…
5
votes
4 answers

How to use gcloud commands programmatically via Python

The Google documentation is a little generic on this topic and I find it hard to get around the different APIs and terms they're using, so I'm wondering if someone could point me to the right direction. I'm looking for a way to call the gcloud…
orange
  • 7,755
  • 14
  • 75
  • 139
4
votes
2 answers

Localhost: how to get credentials to connect GAE Python 3 app and Datastore Emulator?

I'd like to use the new Datastore Emulator together with a GAE Flask app on localhost. I want to run it in the Docker environment, but the error I get (DefaultCredentialsError) happens with or without Docker. My Flask file looks like this (see the…
4
votes
1 answer

ndb query on Google Cloud Platform intermittently returning nothing

I have a Python application deployed on Google Cloud Platform. There is a Google Cloud Datastore in the background, with two Kinds. I use NDB to pull the data into the application. class AttEvent(ndb.Model): event = ndb.StringProperty() …
4
votes
0 answers

How to write data in Google Cloud Bigtable in PySpark application on dataproc?

I am using Spark on a Google Cloud Dataproc cluster and I would like to write in Bigtable in a PySpark job. As google connector for the same is not available, I am simply using google cloud bigtable client to insert the data and use spark for…
4
votes
2 answers

How to authenticate programmatically to a Cloud Identity-Aware Proxy (Cloud IAP)-secured resource using user default credentials?

I would like to be able to programmatically generate an id token for iap using the user default credential on a dev environment (i.e. my own laptop with google cloud sdk installed and logged in). When following the documentation, I managed to…
4
votes
2 answers

Upload python object to Google Cloud Storage without saving it to file

I am clipping images in Python 2.7 on Windows 10 and would like to send them to Google's Cloud Vision API. For images saved locally, I can send them using the google.cloud python module like this: …
bw4sz
  • 2,237
  • 2
  • 29
  • 53
4
votes
2 answers

logging with CloudLoggingHandler from multiple processes

Which is the preferred way to collect and send logs to google cloud logging when logs are produced by several processes ? Here is my CloudLoggingHandler based proposal, would you care to criticize it ? import google from multiprocessing import…
François Kawala
  • 436
  • 3
  • 18
4
votes
2 answers

Google Cloud Storage Python list_blob() not printing object list

I am Python and Google Cloud Storage newbie. I am writing a python script to get a file list from Google Cloud Storage bucket using Google Cloud Python Client Library and list_blobs() function from Bucket class is not working as I…
1
2
3
13 14