Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pub/Sub: update docstrings for client kwargs and fix return types uris #9037

Merged
merged 6 commits into from
Aug 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
45 changes: 38 additions & 7 deletions pubsub/google/cloud/pubsub_v1/publisher/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,44 @@ class Client(object):
kwargs (dict): Any additional arguments provided are sent as keyword
arguments to the underlying
:class:`~.gapic.pubsub.v1.publisher_client.PublisherClient`.
Generally, you should not need to set additional keyword arguments.
Before being passed along to the GAPIC constructor, a channel may
be added if ``credentials`` are passed explicitly or if the
Pub / Sub emulator is detected as running.
Regional endpoints can be set via ``client_options`` that takes a
single key-value pair that defines the endpoint, i.e.
``client_options={"api_endpoint": REGIONAL_ENDPOINT}``.
Generally you should not need to set additional keyword
arguments. Optionally, publish retry settings can be set via
``client_config`` where user-provided retry configurations are
applied to default retry settings. And regional endpoints can be
set via ``client_options`` that takes a single key-value pair that
defines the endpoint.

Example:

.. code-block:: python

from google.cloud import pubsub_v1

publisher_client = pubsub_v1.PublisherClient(
# Optional
batch_settings = pubsub_v1.types.BatchSettings(
max_bytes=1024, # One kilobyte
max_latency=1, # One second
),

# Optional
client_config = {
"interfaces": {
"google.pubsub.v1.Publisher": {
"retry_params": {
"messaging": {
'total_timeout_millis': 650000, # default: 600000
}
}
}
}
},

# Optional
client_options = {
"api_endpoint": REGIONAL_ENDPOINT
}
)
"""

_batch_class = thread.Batch
Expand Down
22 changes: 17 additions & 5 deletions pubsub/google/cloud/pubsub_v1/subscriber/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,23 @@ class Client(object):
kwargs (dict): Any additional arguments provided are sent as keyword
keyword arguments to the underlying
:class:`~.gapic.pubsub.v1.subscriber_client.SubscriberClient`.
Generally, you should not need to set additional keyword
arguments.
Regional endpoints can be set via ``client_options`` that takes a
single key-value pair that defines the endpoint, i.e.
``client_options={"api_endpoint": REGIONAL_ENDPOINT}``.
Generally you should not need to set additional keyword
arguments. Optionally, regional endpoints can be set via
``client_options`` that takes a single key-value pair that
defines the endpoint.

Example:

.. code-block:: python

from google.cloud import pubsub_v1

subscriber_client = pubsub_v1.SubscriberClient(
# Optional
client_options = {
"api_endpoint": REGIONAL_ENDPOINT
}
)
"""

def __init__(self, **kwargs):
Expand Down