Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Python idiomatic client for `Google Cloud Platform`_ services.
.. _Google Cloud Platform: https://cloud.google.com/
|pypi| |versions|
google-cloud
Warning: This package has moved. It has been renamed to
google-cloud on PyPI
_. No new releases will be made for
gcloud
.
.. _google-cloud on PyPI: https://pypi.python.org/pypi/google-cloud
Homepage
_API Documentation
_.. _Homepage: https://googlecloudplatform.github.io/gcloud-python/ .. _API Documentation: http://googlecloudplatform.github.io/gcloud-python/stable/
This client supports the following Google Cloud Platform services:
Datastore
_Storage
_Pub/Sub
_BigQuery
_Resource Manager
_Stackdriver Logging
_.. _Datastore: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-datastore .. _Storage: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-storage .. _Pub/Sub: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-pubsub .. _BigQuery: https://github.com/GoogleCloudPlatform/gcloud-python#google-bigquery .. _Resource Manager: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-resource-manager .. _Stackdriver Logging: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-logging
If you need support for other Google APIs, check out the
Google APIs Python Client library
_.
.. _Google APIs Python Client library: https://github.com/google/google-api-python-client
::
$ pip install --upgrade gcloud
getting-started-python
_ - A sample and tutorial
_ that demonstrates how to build a complete web application using Cloud Datastore, Cloud Storage, and Cloud Pub/Sub and deploy it to Google App Engine or Google Compute Engine.gcloud-python-expenses-demo
_ - A sample expenses demo using Cloud Datastore and Cloud Storage.. _getting-started-python: https://github.com/GoogleCloudPlatform/getting-started-python .. _tutorial: https://cloud.google.com/python .. _gcloud-python-expenses-demo: https://github.com/GoogleCloudPlatform/gcloud-python-expenses-demo
With gcloud-python
we try to make authentication as painless as possible.
Check out the Authentication section
_ in our documentation to learn more.
You may also find the authentication document
_ shared by all the gcloud-*
libraries to be helpful.
.. _Authentication section: http://gcloud-python.readthedocs.org/en/latest/gcloud-auth.html .. _authentication document: https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication
Google Cloud Datastore
_ (Datastore API docs
_) is a fully managed, schemaless
database for storing non-relational data. Cloud Datastore automatically scales
with your users and supports ACID transactions, high availability of reads and
writes, strong consistency for reads and ancestor queries, and eventual
consistency for all other queries.
.. _Cloud Datastore: https://cloud.google.com/datastore/docs .. _Datastore API docs: https://cloud.google.com/datastore/docs/apis/v1beta3/
See the gcloud-python
API datastore documentation
_ to learn how to
interact with the Cloud Datastore using this Client Library.
.. _datastore documentation: https://googlecloudplatform.github.io/gcloud-python/stable/datastore-client.html
See the official Google Cloud Datastore documentation
_ for more details on how
to activate Cloud Datastore for your project.
.. _official Google Cloud Datastore documentation: https://cloud.google.com/datastore/docs/activate
.. code:: python
from gcloud import datastore
# Create, populate and persist an entity
entity = datastore.Entity(key=datastore.Key('EntityKind'))
entity.update({
'foo': u'bar',
'baz': 1337,
'qux': False,
})
# Then query for entities
query = datastore.Query(kind='EntityKind')
for result in query.fetch():
print result
Google Cloud Storage
_ (Storage API docs
_) allows you to store data on Google
infrastructure with very high reliability, performance and availability, and can
be used to distribute large data objects to users via direct download.
.. _Cloud Storage: https://cloud.google.com/storage/docs .. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1
See the gcloud-python
API storage documentation
_ to learn how to connect
to Cloud Storage using this Client Library.
.. _storage documentation: https://googlecloudplatform.github.io/gcloud-python/stable/storage-client.html
You need to create a Google Cloud Storage bucket to use this client library.
Follow along with the official Google Cloud Storage documentation
_ to learn
how to create a bucket.
.. _official Google Cloud Storage documentation: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
.. code:: python
from gcloud import storage
client = storage.Client()
bucket = client.get_bucket('bucket-id-here')
# Then do other things...
blob = bucket.get_blob('remote/path/to/file.txt')
print blob.download_as_string()
blob.upload_from_string('New contents!')
blob2 = bucket.blob('remote/path/storage.txt')
blob2.upload_from_filename(filename='/local/path.txt')
Google Cloud Pub/Sub
_ (Pub/Sub API docs
_) is designed to provide reliable,
many-to-many, asynchronous messaging between applications. Publisher
applications can send messages to a topic
and other applications can
subscribe to that topic to receive the messages. By decoupling senders and
receivers, Google Cloud Pub/Sub allows developers to communicate between
independently written applications.
.. _Cloud Pub/Sub: https://cloud.google.com/pubsub/docs .. _Pub/Sub API docs: https://cloud.google.com/pubsub/reference/rest/
See the gcloud-python
API Pub/Sub documentation
_ to learn how to connect
to Cloud Pub/Sub using this Client Library.
.. _Pub/Sub documentation: https://googlecloudplatform.github.io/gcloud-python/stable/pubsub-usage.html
To get started with this API, you'll need to create
.. code:: python
from gcloud import pubsub
client = pubsub.Client()
topic = client.topic('topic_name')
topic.create()
topic.publish('this is the message_payload',
attr1='value1', attr2='value2')
Querying massive datasets can be time consuming and expensive without the
right hardware and infrastructure. Google
BigQuery
__ (BigQuery API docs
_)
solves this problem by enabling super-fast, SQL-like queries against
append-only tables, using the processing power of Google's infrastructure.
.. _BQ-indirect: https://cloud.google.com/bigquery/what-is-bigquery
.. BigQuery API docs: https://cloud.google.com/bigquery/docs/reference/v2/
__ BQ-indirect
This package is still being implemented, but it is almost complete!
Load data from CSV
.. code:: python
import csv
from gcloud import bigquery
from gcloud.bigquery import SchemaField
client = bigquery.Client()
dataset = client.dataset('dataset_name')
dataset.create() # API request
SCHEMA = [
SchemaField('full_name', 'STRING', mode='required'),
SchemaField('age', 'INTEGER', mode='required'),
]
table = dataset.table('table_name', SCHEMA)
table.create()
with open('csv_file', 'rb') as readable:
table.upload_from_file(
readable, source_format='CSV', skip_leading_rows=1)
Perform a synchronous query
.. code:: python
# Perform a synchronous query.
QUERY = (
'SELECT name FROM [bigquery-public-data:usa_names.usa_1910_2013] '
'WHERE state = "TX"')
query = client.run_sync_query('%s LIMIT 100' % QUERY)
query.timeout_ms = TIMEOUT_MS
query.run()
for row in query.rows:
print row
See the gcloud-python
API BigQuery documentation
_ to learn how to connect
to BigQuery using this Client Library.
.. _BigQuery documentation: https://googlecloudplatform.github.io/gcloud-python/stable/bigquery-usage.html
The Cloud Resource Manager
__ API (Resource Manager API docs
_) provides
methods that you can use to programmatically manage your projects in the
Google Cloud Platform.
.. _RM-indirect: https://cloud.google.com/resource-manager/
.. Resource Manager API docs: https://cloud.google.com/resource-manager/reference/rest/
__ RM-indirect
See the gcloud-python
API Resource Manager documentation
_ to learn how to
manage projects using this Client Library.
.. _Resource Manager documentation: https://googlecloudplatform.github.io/gcloud-python/stable/resource-manager-api.html
Stackdriver Logging
__ API (Logging API docs
_) allows you to store, search,
analyze, monitor, and alert on log data and events from Google Cloud Platform.
.. _SL-indirect: https://cloud.google.com/logging/
.. Logging API docs: https://cloud.google.com/logging/docs/
__ SL-indirect
.. code:: python
from gcloud import logging
client = logging.Client()
logger = client.logger('log_name')
logger.log_text("A simple entry") # API call
Example of fetching entries:
.. code:: python
entries, token = logger.list_entries()
for entry in entries:
print entry.payload
See the gcloud-python
API logging documentation
_ to learn how to connect
to Stackdriver Logging using this Client Library.
.. _logging documentation: https://googlecloudplatform.github.io/gcloud-python/stable/logging-usage.html
Contributions to this library are always welcome and highly encouraged.
See CONTRIBUTING doc
_ for more information on how to get started.
.. _CONTRIBUTING doc: https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/CONTRIBUTING.rst
Apache 2.0 - See the LICENSE
_ for more information.
.. _the LICENSE: https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/LICENSE
.. |build| image:: https://travis-ci.org/GoogleCloudPlatform/gcloud-python.svg?branch=master :target: https://travis-ci.org/GoogleCloudPlatform/gcloud-python .. |coverage| image:: https://codecov.io/gh/GoogleCloudPlatform/gcloud-python/branch/master/graph/badge.svg :target: https://codecov.io/gh/GoogleCloudPlatform/gcloud-python .. |pypi| image:: https://img.shields.io/pypi/v/gcloud.svg :target: https://pypi.python.org/pypi/gcloud .. |versions| image:: https://img.shields.io/pypi/pyversions/gcloud.svg :target: https://pypi.python.org/pypi/gcloud
FAQs
API Client library for Google Cloud
We found that gcloud demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.