class documentation

class Channel(object):

Constructor: Channel(type, id, token, address, ...)

View In Hierarchy

A Channel for notifications.

Usually not constructed directly, instead it is returned from helper functions like new_webhook_channel().

Method __init__ Create a new Channel.
Method body Build a body from the Channel.
Method update Update a channel with information from the response of watch().
Instance Variable address str, The address of the receiving entity where events are delivered. Specific to the channel type.
Instance Variable expiration int, The time, in milliseconds from the epoch, when this channel will expire.
Instance Variable id str, A UUID for the channel.
Instance Variable params dict, A dictionary of string to string, with additional parameters controlling delivery channel behavior.
Instance Variable resource_id str, An opaque id that identifies the resource that is being watched. Stable across different API versions.
Instance Variable resource_uri str, The canonicalized ID of the watched resource.
Instance Variable token str, An arbitrary string associated with the channel that is delivered to the target address with each event delivered over this channel.
Instance Variable type str, The type of delivery mechanism used by this channel. For example, 'web_hook'.
@util.positional(5)
def __init__(self, type, id, token, address, expiration=None, params=None, resource_id='', resource_uri=''):

Create a new Channel.

In user code, this Channel constructor will not typically be called manually since there are functions for creating channels for each specific type with a more customized set of arguments to pass.

Parameters
typestr, The type of delivery mechanism used by this channel. For example, 'web_hook'.
idstr, A UUID for the channel.
tokenstr, An arbitrary string associated with the channel that is delivered to the target address with each event delivered over this channel.
addressstr, The address of the receiving entity where events are delivered. Specific to the channel type.
expirationint, The time, in milliseconds from the epoch, when this channel will expire.
paramsdict, A dictionary of string to string, with additional parameters controlling delivery channel behavior.
resource_idstr, An opaque id that identifies the resource that is being watched. Stable across different API versions.
resource_uristr, The canonicalized ID of the watched resource.
def body(self):

Build a body from the Channel.

Constructs a dictionary that's appropriate for passing into watch() methods as the value of body argument.

Returns
A dictionary representation of the channel.
def update(self, resp):

Update a channel with information from the response of watch().

When a request is sent to watch() a resource, the response returned from the watch() request is a dictionary with updated channel information, such as the resource_id, which is needed when stopping a subscription.

Parameters
respdict, The response from a watch() method.
address =

str, The address of the receiving entity where events are delivered. Specific to the channel type.

expiration =

int, The time, in milliseconds from the epoch, when this channel will expire.

id =

str, A UUID for the channel.

params =

dict, A dictionary of string to string, with additional parameters controlling delivery channel behavior.

resource_id =

str, An opaque id that identifies the resource that is being watched. Stable across different API versions.

resource_uri =

str, The canonicalized ID of the watched resource.

token =

str, An arbitrary string associated with the channel that is delivered to the target address with each event delivered over this channel.

type =

str, The type of delivery mechanism used by this channel. For example, 'web_hook'.