pubsub.subscriber_client

Attributes

SCOPES

Classes

SubscriberClient

Functions

init_api_root(api_root)

Module Contents

pubsub.subscriber_client.SCOPES = ['https://www.googleapis.com/auth/pubsub']
pubsub.subscriber_client.init_api_root(api_root)
Parameters:

api_root (Optional[str])

Return type:

Tuple[bool, str]

class pubsub.subscriber_client.SubscriberClient(*, service_file=None, token=None, session=None, api_root=None)
Parameters:
  • service_file (Optional[Union[str, IO[AnyStr]]])

  • token (Optional[gcloud.aio.auth.Token])

  • session (Optional[requests.Session])

  • api_root (Optional[str])

_api_root: str
_api_is_dev: bool
session
token
static project_path(project)
Parameters:

project (str)

Return type:

str

classmethod subscription_path(project, subscription)
Parameters:
  • project (str)

  • subscription (str)

Return type:

str

classmethod topic_path(project, topic)
Parameters:
  • project (str)

  • topic (str)

Return type:

str

async _headers()
Return type:

Dict[str, str]

async create_subscription(subscription, topic, body=None, *, session=None, timeout=10)

Create subscription.

Parameters:
  • subscription (str)

  • topic (str)

  • body (Optional[Dict[str, Any]])

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

Dict[str, Any]

async patch_subscription(subscription, body, *, session=None, timeout=10)
Parameters:
  • subscription (str)

  • body (Dict[str, Any])

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

Dict[str, Any]

async delete_subscription(subscription, *, session=None, timeout=10)

Delete subscription.

Parameters:
  • subscription (str)

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

None

async pull(subscription, max_messages, *, session=None, timeout=30)

Pull messages from subscription

Parameters:
  • subscription (str)

  • max_messages (int)

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

List[pubsub.subscriber_message.SubscriberMessage]

async acknowledge(subscription, ack_ids, *, session=None, timeout=10)

Acknowledge messages by ackIds

Parameters:
  • subscription (str)

  • ack_ids (List[str])

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

None

async modify_ack_deadline(subscription, ack_ids, ack_deadline_seconds, *, session=None, timeout=10)

Modify messages’ ack deadline. Set ack deadline to 0 to nack messages.

Parameters:
  • subscription (str)

  • ack_ids (List[str])

  • ack_deadline_seconds (int)

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

None

async get_subscription(subscription, *, session=None, timeout=10)

Get Subscription

Parameters:
  • subscription (str)

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

Dict[str, Any]

async list_subscriptions(project, query_params=None, *, session=None, timeout=10)

List subscriptions

Parameters:
  • project (str)

  • query_params (Optional[Dict[str, str]])

  • session (Optional[requests.Session])

  • timeout (int)

Return type:

Dict[str, Any]

async close()
Return type:

None

async __aenter__()
Return type:

SubscriberClient

async __aexit__(*args)
Parameters:

args (Any)

Return type:

None