Google Cloud Python Client
==========================
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
Overview
--------
- `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:
- Google Cloud `Datastore`_
- Google Cloud `Storage`_
- Google Cloud `Pub/Sub`_
- Google `BigQuery`_
- Google Cloud `Resource Manager`_
- Google `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
Quick Start
-----------
::
$ pip install --upgrade gcloud
Example Applications
--------------------
- `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
Authentication
--------------
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
----------------------
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
--------------------
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
--------------------
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')
Google BigQuery
---------------
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
Google Cloud Resource Manager
-----------------------------
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
Google Stackdriver Logging
--------------------------
`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
Contributing
------------
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
License
-------
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
Raw data
{
"_id": null,
"home_page": "https://github.com/GoogleCloudPlatform/gcloud-python",
"name": "gcloud",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Google Cloud Platform",
"author_email": "jjg+gcloud-python at google com",
"download_url": "https://files.pythonhosted.org/packages/11/ab/d0cee58db2d8445c26e6f5db25d9b1f1aa14a3ab30eea8ce77ae808d10ef/gcloud-0.18.3.tar.gz",
"platform": "Posix; MacOS X; Windows",
"description": "Google Cloud Python Client\n==========================\n\n Python idiomatic client for `Google Cloud Platform`_ services.\n\n.. _Google Cloud Platform: https://cloud.google.com/\n\n|pypi| |versions|\n\n``google-cloud``\n----------------\n\n**Warning**: This package has moved. It has been renamed to\n`google-cloud on PyPI`_. No new releases will be made for\n``gcloud``.\n\n.. _google-cloud on PyPI: https://pypi.python.org/pypi/google-cloud\n\nOverview\n--------\n\n- `Homepage`_\n- `API Documentation`_\n\n.. _Homepage: https://googlecloudplatform.github.io/gcloud-python/\n.. _API Documentation: http://googlecloudplatform.github.io/gcloud-python/stable/\n\nThis client supports the following Google Cloud Platform services:\n\n- Google Cloud `Datastore`_\n- Google Cloud `Storage`_\n- Google Cloud `Pub/Sub`_\n- Google `BigQuery`_\n- Google Cloud `Resource Manager`_\n- Google `Stackdriver Logging`_\n\n.. _Datastore: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-datastore\n.. _Storage: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-storage\n.. _Pub/Sub: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-pubsub\n.. _BigQuery: https://github.com/GoogleCloudPlatform/gcloud-python#google-bigquery\n.. _Resource Manager: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-resource-manager\n.. _Stackdriver Logging: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-logging\n\nIf you need support for other Google APIs, check out the\n`Google APIs Python Client library`_.\n\n.. _Google APIs Python Client library: https://github.com/google/google-api-python-client\n\nQuick Start\n-----------\n\n::\n\n $ pip install --upgrade gcloud\n\nExample Applications\n--------------------\n\n- `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.\n- `gcloud-python-expenses-demo`_ - A sample expenses demo using Cloud Datastore and Cloud Storage\n\n.. _getting-started-python: https://github.com/GoogleCloudPlatform/getting-started-python\n.. _tutorial: https://cloud.google.com/python\n.. _gcloud-python-expenses-demo: https://github.com/GoogleCloudPlatform/gcloud-python-expenses-demo\n\nAuthentication\n--------------\n\nWith ``gcloud-python`` we try to make authentication as painless as possible.\nCheck out the `Authentication section`_ in our documentation to learn more.\nYou may also find the `authentication document`_ shared by all the ``gcloud-*``\nlibraries to be helpful.\n\n.. _Authentication section: http://gcloud-python.readthedocs.org/en/latest/gcloud-auth.html\n.. _authentication document: https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication\n\nGoogle Cloud Datastore\n----------------------\n\nGoogle `Cloud Datastore`_ (`Datastore API docs`_) is a fully managed, schemaless\ndatabase for storing non-relational data. Cloud Datastore automatically scales\nwith your users and supports ACID transactions, high availability of reads and\nwrites, strong consistency for reads and ancestor queries, and eventual\nconsistency for all other queries.\n\n.. _Cloud Datastore: https://cloud.google.com/datastore/docs\n.. _Datastore API docs: https://cloud.google.com/datastore/docs/apis/v1beta3/\n\nSee the ``gcloud-python`` API `datastore documentation`_ to learn how to\ninteract with the Cloud Datastore using this Client Library.\n\n.. _datastore documentation: https://googlecloudplatform.github.io/gcloud-python/stable/datastore-client.html\n\nSee the `official Google Cloud Datastore documentation`_ for more details on how\nto activate Cloud Datastore for your project.\n\n.. _official Google Cloud Datastore documentation: https://cloud.google.com/datastore/docs/activate\n\n.. code:: python\n\n from gcloud import datastore\n # Create, populate and persist an entity\n entity = datastore.Entity(key=datastore.Key('EntityKind'))\n entity.update({\n 'foo': u'bar',\n 'baz': 1337,\n 'qux': False,\n })\n # Then query for entities\n query = datastore.Query(kind='EntityKind')\n for result in query.fetch():\n print result\n\nGoogle Cloud Storage\n--------------------\n\nGoogle `Cloud Storage`_ (`Storage API docs`_) allows you to store data on Google\ninfrastructure with very high reliability, performance and availability, and can\nbe used to distribute large data objects to users via direct download.\n\n.. _Cloud Storage: https://cloud.google.com/storage/docs\n.. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1\n\nSee the ``gcloud-python`` API `storage documentation`_ to learn how to connect\nto Cloud Storage using this Client Library.\n\n.. _storage documentation: https://googlecloudplatform.github.io/gcloud-python/stable/storage-client.html\n\nYou need to create a Google Cloud Storage bucket to use this client library.\nFollow along with the `official Google Cloud Storage documentation`_ to learn\nhow to create a bucket.\n\n.. _official Google Cloud Storage documentation: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets\n\n.. code:: python\n\n from gcloud import storage\n client = storage.Client()\n bucket = client.get_bucket('bucket-id-here')\n # Then do other things...\n blob = bucket.get_blob('remote/path/to/file.txt')\n print blob.download_as_string()\n blob.upload_from_string('New contents!')\n blob2 = bucket.blob('remote/path/storage.txt')\n blob2.upload_from_filename(filename='/local/path.txt')\n\nGoogle Cloud Pub/Sub\n--------------------\n\nGoogle `Cloud Pub/Sub`_ (`Pub/Sub API docs`_) is designed to provide reliable,\nmany-to-many, asynchronous messaging between applications. Publisher\napplications can send messages to a ``topic`` and other applications can\nsubscribe to that topic to receive the messages. By decoupling senders and\nreceivers, Google Cloud Pub/Sub allows developers to communicate between\nindependently written applications.\n\n.. _Cloud Pub/Sub: https://cloud.google.com/pubsub/docs\n.. _Pub/Sub API docs: https://cloud.google.com/pubsub/reference/rest/\n\nSee the ``gcloud-python`` API `Pub/Sub documentation`_ to learn how to connect\nto Cloud Pub/Sub using this Client Library.\n\n.. _Pub/Sub documentation: https://googlecloudplatform.github.io/gcloud-python/stable/pubsub-usage.html\n\nTo get started with this API, you'll need to create\n\n.. code:: python\n\n from gcloud import pubsub\n\n client = pubsub.Client()\n topic = client.topic('topic_name')\n topic.create()\n\n topic.publish('this is the message_payload',\n attr1='value1', attr2='value2')\n\nGoogle BigQuery\n---------------\n\nQuerying massive datasets can be time consuming and expensive without the\nright hardware and infrastructure. Google\n`BigQuery`__ (`BigQuery API docs`_)\nsolves this problem by enabling super-fast, SQL-like queries against\nappend-only tables, using the processing power of Google's infrastructure.\n\n.. _BQ-indirect: https://cloud.google.com/bigquery/what-is-bigquery\n.. _BigQuery API docs: https://cloud.google.com/bigquery/docs/reference/v2/\n__ `BQ-indirect`_\n\nThis package is still being implemented, but it is almost complete!\n\nLoad data from CSV\n~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n import csv\n\n from gcloud import bigquery\n from gcloud.bigquery import SchemaField\n\n client = bigquery.Client()\n\n dataset = client.dataset('dataset_name')\n dataset.create() # API request\n\n SCHEMA = [\n SchemaField('full_name', 'STRING', mode='required'),\n SchemaField('age', 'INTEGER', mode='required'),\n ]\n table = dataset.table('table_name', SCHEMA)\n table.create()\n\n with open('csv_file', 'rb') as readable:\n table.upload_from_file(\n readable, source_format='CSV', skip_leading_rows=1)\n\nPerform a synchronous query\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n # Perform a synchronous query.\n QUERY = (\n 'SELECT name FROM [bigquery-public-data:usa_names.usa_1910_2013] '\n 'WHERE state = \"TX\"')\n query = client.run_sync_query('%s LIMIT 100' % QUERY)\n query.timeout_ms = TIMEOUT_MS\n query.run()\n\n for row in query.rows:\n print row\n\n\nSee the ``gcloud-python`` API `BigQuery documentation`_ to learn how to connect\nto BigQuery using this Client Library.\n\n.. _BigQuery documentation: https://googlecloudplatform.github.io/gcloud-python/stable/bigquery-usage.html\n\nGoogle Cloud Resource Manager\n-----------------------------\n\nThe Cloud `Resource Manager`__ API (`Resource Manager API docs`_) provides\nmethods that you can use to programmatically manage your projects in the\nGoogle Cloud Platform.\n\n.. _RM-indirect: https://cloud.google.com/resource-manager/\n.. _Resource Manager API docs: https://cloud.google.com/resource-manager/reference/rest/\n__ `RM-indirect`_\n\nSee the ``gcloud-python`` API `Resource Manager documentation`_ to learn how to\nmanage projects using this Client Library.\n\n.. _Resource Manager documentation: https://googlecloudplatform.github.io/gcloud-python/stable/resource-manager-api.html\n\nGoogle Stackdriver Logging\n--------------------------\n\n`Stackdriver Logging`__ API (`Logging API docs`_) allows you to store, search,\nanalyze, monitor, and alert on log data and events from Google Cloud Platform.\n\n.. _SL-indirect: https://cloud.google.com/logging/\n.. _Logging API docs: https://cloud.google.com/logging/docs/\n__ `SL-indirect`_\n\n.. code:: python\n\n from gcloud import logging\n client = logging.Client()\n logger = client.logger('log_name')\n logger.log_text(\"A simple entry\") # API call\n\nExample of fetching entries:\n\n.. code:: python\n\n entries, token = logger.list_entries()\n for entry in entries:\n print entry.payload\n\nSee the ``gcloud-python`` API `logging documentation`_ to learn how to connect\nto Stackdriver Logging using this Client Library.\n\n.. _logging documentation: https://googlecloudplatform.github.io/gcloud-python/stable/logging-usage.html\n\nContributing\n------------\n\nContributions to this library are always welcome and highly encouraged.\n\nSee `CONTRIBUTING doc`_ for more information on how to get started.\n\n.. _CONTRIBUTING doc: https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/CONTRIBUTING.rst\n\nLicense\n-------\n\nApache 2.0 - See `the LICENSE`_ for more information.\n\n.. _the LICENSE: https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/LICENSE\n\n.. |build| image:: https://travis-ci.org/GoogleCloudPlatform/gcloud-python.svg?branch=master\n :target: https://travis-ci.org/GoogleCloudPlatform/gcloud-python\n.. |coverage| image:: https://codecov.io/gh/GoogleCloudPlatform/gcloud-python/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/GoogleCloudPlatform/gcloud-python\n.. |pypi| image:: https://img.shields.io/pypi/v/gcloud.svg\n :target: https://pypi.python.org/pypi/gcloud\n.. |versions| image:: https://img.shields.io/pypi/pyversions/gcloud.svg\n :target: https://pypi.python.org/pypi/gcloud",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "API Client library for Google Cloud",
"version": "0.18.3",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "66bda7eac1489782ad87284ac330d98a",
"sha256": "0af2dec59fce20561752f86e42d981c6a255e306a6c5e5d1fa3d358a8857e4fb"
},
"downloads": -1,
"filename": "gcloud-0.18.3.tar.gz",
"has_sig": false,
"md5_digest": "66bda7eac1489782ad87284ac330d98a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 454375,
"upload_time": "2016-09-23T16:39:31",
"upload_time_iso_8601": "2016-09-23T16:39:31.124469Z",
"url": "https://files.pythonhosted.org/packages/11/ab/d0cee58db2d8445c26e6f5db25d9b1f1aa14a3ab30eea8ce77ae808d10ef/gcloud-0.18.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2016-09-23 16:39:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "GoogleCloudPlatform",
"github_project": "gcloud-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gcloud"
}