Thread-safe client functionality for gcloud-python via requests.
pip install --upgrade gcloud_requests
Note that at this time, only gcloud==0.8.0
on Python 2.7 is
officially supported.
The library provides new HTTP objects that can be passed in to the
gcloud.*.Client
constructors (per supported API module). For example,
to use the connection class (with proper retrying implemented) for
Google Cloud Datastore:
from gcloud import datastore
from gcloud_requests.connection import datastore_connection
client = datastore.Client(http=datastore_connection.http)
client.query(kind="EntityKind").fetch()
and for Google Cloud Storage:
from gcloud import storage
from gcloud_requests.connection import storage_connection
client = gcloud.storage.Client(http=storage_connection.http, project="my-project")
bucket = client.get_bucket("my-bucket")
The following connections are available:
bigquery_connection
datastore_connection
dns_connection
pubsub_connection
resource_manager_connection
storage_connection
The gcloud-python library for accessing Google Cloud
Platform services like Google Cloud Datastore, Google Cloud Storage,
Google BigQuery, and others, relies on the httplib2
library to handle
the underlying Protobuf requests. This library (httplib2
) is not
threadsafe.
Based on notes in gcloud-python#926, gcloud-python#908,
and gcloud-python#1214, this library replaces the
underlying transport with requests
.
It's strongly encouraged that you let Travis run the tests. This is
because running the tests requires gcd
, the Google Cloud Datastore
tools, which also requires a Google Cloud Platform service key...if
you're still intrigued, work through the gcd documentation
and
then simply install pytest
and run the tests with py.test
.
gcloud_requests
was authored at LeadPages. You can
find out more about contributors here. We welcome
contributions, and we're always looking for more
engineering talent!
Please read our contributor's guide.