Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/datastore-quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ You can install the library quickly with ``pip``::

$ pip install gcloud

Run the demo
------------

In order to run the demo, you need to have registred an actual ``gcloud``
project and so you'll need to provide some environment variables to facilitate
authentication to your project:

- ``GCLOUD_TESTS_PROJECT_ID``: Developers Console project ID (e.g.
bamboo-shift-455).
- ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to.
This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``.
- ``GCLOUD_TESTS_CLIENT_EMAIL``: The email for the service account you're
authenticating with
- ``GCLOUD_TESTS_KEY_FILE``: The path to an encrypted key file.
See private key
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
for explanation on how to get a private key.

Run the
`example script <https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/datastore/demo/demo.py>`_
included in the package::
Expand Down
18 changes: 18 additions & 0 deletions docs/storage-quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ You can install the library quickly with ``pip``::

$ pip install gcloud

Run the demo
------------

In order to run the demo, you need to have registred an actual ``gcloud``
project and so you'll need to provide some environment variables to facilitate
authentication to your project:

- ``GCLOUD_TESTS_PROJECT_ID``: Developers Console project ID (e.g.
bamboo-shift-455).
- ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to.
This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``.
- ``GCLOUD_TESTS_CLIENT_EMAIL``: The email for the service account you're
authenticating with
- ``GCLOUD_TESTS_KEY_FILE``: The path to an encrypted key file.
See private key
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
for explanation on how to get a private key.

Run the
`example script <https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/storage/demo/demo.py>`_
included in the package::
Expand Down
12 changes: 6 additions & 6 deletions gcloud/datastore/demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import os
from gcloud import datastore

__all__ = ['get_dataset', 'CLIENT_EMAIL', 'DATASET_ID', 'PRIVATE_KEY_PATH']
__all__ = ['get_dataset', 'CLIENT_EMAIL', 'DATASET_ID', 'KEY_FILENAME']

CLIENT_EMAIL = ('754762820716-gimou6egs2hq1rli7el2t621a1b04t9i'
'@developer.gserviceaccount.com')
DATASET_ID = 'gcloud-datastore-demo'
PRIVATE_KEY_PATH = os.path.join(os.path.dirname(__file__), 'demo.key')

DATASET_ID = os.getenv('GCLOUD_TESTS_DATASET_ID')

This comment was marked as spam.

CLIENT_EMAIL = os.getenv('GCLOUD_TESTS_CLIENT_EMAIL')
KEY_FILENAME = os.getenv('GCLOUD_TESTS_KEY_FILE')


def get_dataset(): # pragma NO COVER
return datastore.get_dataset(DATASET_ID, CLIENT_EMAIL, PRIVATE_KEY_PATH)
return datastore.get_dataset(DATASET_ID, CLIENT_EMAIL, KEY_FILENAME)
Binary file removed gcloud/datastore/demo/demo.key
Binary file not shown.
11 changes: 5 additions & 6 deletions gcloud/storage/demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import os
from gcloud import storage

__all__ = ['get_connection', 'CLIENT_EMAIL', 'PRIVATE_KEY_PATH', 'PROJECT']
__all__ = ['get_connection', 'CLIENT_EMAIL', 'KEY_FILENAME', 'PROJECT_ID']

CLIENT_EMAIL = ('606734090113-6ink7iugcv89da9sru7lii8bs3i0obqg@'
'developer.gserviceaccount.com')
PRIVATE_KEY_PATH = os.path.join(os.path.dirname(__file__), 'demo.key')
PROJECT = 'gcloud-storage-demo'
PROJECT_ID = os.getenv('GCLOUD_TESTS_PROJECT_ID')
CLIENT_EMAIL = os.getenv('GCLOUD_TESTS_CLIENT_EMAIL')
KEY_FILENAME = os.getenv('GCLOUD_TESTS_KEY_FILE')


def get_connection(): # pragma NO COVER.
return storage.get_connection(PROJECT, CLIENT_EMAIL, PRIVATE_KEY_PATH)
return storage.get_connection(PROJECT_ID, CLIENT_EMAIL, KEY_FILENAME)
Binary file removed gcloud/storage/demo/demo.key
Binary file not shown.