diff --git a/bigquery/cloud-client/quickstart.py b/bigquery/cloud-client/quickstart.py index 25d2ea0c2dce..21bd9aa4518a 100644 --- a/bigquery/cloud-client/quickstart.py +++ b/bigquery/cloud-client/quickstart.py @@ -18,12 +18,18 @@ # Imports the Google Cloud client library from gcloud import bigquery -# Instantiates the client library -bigquery_client = bigquery.Client(project='YOUR_PROJECT_ID') +# Your Google Cloud Platform project ID +project_id = 'YOUR_PROJECT_ID' -# Prepares a new dataset -dataset = bigquery_client.dataset('my_new_dataset') +# Instantiates a client +bigquery_client = bigquery.Client(project=project_id) -# Creates the dataset +# The name for the new dataset +dataset_name = 'my_new_dataset' + +# Prepares the new dataset +dataset = bigquery_client.dataset(dataset_name) + +# Creates the new dataset dataset.create() # [END bigquery_quickstart] diff --git a/datastore/api/quickstart.py b/datastore/api/quickstart.py index d5a5885db9c7..4adfd1de6039 100644 --- a/datastore/api/quickstart.py +++ b/datastore/api/quickstart.py @@ -18,11 +18,19 @@ # Imports the Google Cloud client library from gcloud import datastore -# Instantiates the client library -datastore_client = datastore.Client(project='YOUR_PROJECT_ID') +# Your Google Cloud Platform project ID +project_id = 'YOUR_PROJECT_ID' -task_key = datastore_client.key('Task', 1234) +# Instantiates a client +datastore_client = datastore.Client(project=project_id) -# Retrieves an entity +# The kind of the entity to retrieve +kind = 'Task' +# The id of the entity to retrieve +id = 1234567890 +# The Datastore key for the entity +task_key = datastore_client.key(kind, id) + +# Retrieves the entity entity = datastore_client.get(task_key) # [END datastore_quickstart] diff --git a/logging/cloud-client/quickstart.py b/logging/cloud-client/quickstart.py index f951783597df..617af90ef49d 100644 --- a/logging/cloud-client/quickstart.py +++ b/logging/cloud-client/quickstart.py @@ -18,12 +18,20 @@ # Imports the Google Cloud client library from gcloud import logging -# Instantiates the client library -logging_client = logging.Client(project='YOUR_PROJECT_ID') +# Your Google Cloud Platform project ID +project_id = 'YOUR_PROJECT_ID' +# Instantiates a client +logging_client = logging.Client(project=project_id) + +# The name of the log to write to +log_name = 'my-log' # Selects the log to write to -logger = logging_client.logger('my-log') +logger = logging_client.logger(log_name) + +# The data to log +text = 'Hello, world!' -# Writes a log entry -logger.log_text('Hello, world!') +# Writes the log entry +logger.log_text(text) # [END logging_quickstart] diff --git a/pubsub/cloud-client/quickstart.py b/pubsub/cloud-client/quickstart.py index dc34f9dfb296..ddfca002c788 100644 --- a/pubsub/cloud-client/quickstart.py +++ b/pubsub/cloud-client/quickstart.py @@ -18,12 +18,18 @@ # Imports the Google Cloud client library from gcloud import pubsub -# Instantiates the client library -pubsub_client = pubsub.Client(project='YOUR_PROJECT_ID') +# Your Google Cloud Platform project ID +project_id = 'YOUR_PROJECT_ID' -# Prepares a new topic -topic = pubsub_client.topic('my-new-topic') +# Instantiates a client +pubsub_client = pubsub.Client(project=project_id) -# Creates the topic +# The name for the new topic +topic_name = 'my-new-topic' + +# Prepares the new topic +topic = pubsub_client.topic(topic_name) + +# Creates the new topic topic.create() # [END pubsub_quickstart] diff --git a/storage/cloud-client/quickstart.py b/storage/cloud-client/quickstart.py index baa09c4f7f53..16d8cc906841 100644 --- a/storage/cloud-client/quickstart.py +++ b/storage/cloud-client/quickstart.py @@ -18,9 +18,15 @@ # Imports the Google Cloud client library from gcloud import storage -# Instantiates the client library -storage_client = storage.Client(project='YOUR_PROJECT_ID') +# Your Google Cloud Platform project ID +project_id = 'YOUR_PROJECT_ID' -# Creates a new bucket -bucket = storage_client.create_bucket('my-new-bucket') +# Instantiates a client +storage_client = storage.Client(project=project_id) + +# The name for the new bucket +bucket_name = 'my-new-bucket' + +# Creates the new bucket +bucket = storage_client.create_bucket(bucket_name) # [END storage_quickstart] diff --git a/translate/cloud-client/quickstart.py b/translate/cloud-client/quickstart.py index df42b20a57b3..b8efa54381f4 100644 --- a/translate/cloud-client/quickstart.py +++ b/translate/cloud-client/quickstart.py @@ -18,9 +18,17 @@ # Imports the Google Cloud client library from gcloud import translate -# Instantiates the client library -translate_client = translate.Client('YOUR_API_KEY') +# Your Translate API key +api_key = 'YOUR_API_KEY' + +# Instantiates a client +translate_client = translate.Client(api_key) + +# The text to translate +text = 'Hello, world!' +# The target language +target = 'ru' # Translates some text into Russian -translation = translate_client.translate('Hello, world!', target_language='ru') +translation = translate_client.translate(text, target_language=target) # [END translate_quickstart]