File manager - Edit - /usr/local/CyberPanel/lib/python3.10/site-packages/googleapiclient/__pycache__/channel.cpython-310.pyc
Back
o �h.+ � @ s� d Z ddlmZ ddlZddlZddlmZ ddlmZ e�ddd�Z dd d ddd ddd�Z dZdZdZ dZdZdd� ZG dd� de�ZG dd� de�Zdd� Ze�d�d!dd ��ZdS )"a� Channel notifications support. Classes and functions to support channel subscriptions and notifications on those channels. Notes: - This code is based on experimental APIs and is subject to change. - Notification does not do deduplication of notification ids, that's up to the receiver. - Storing the Channel between calls is up to the caller. Example setting up a channel: # Create a new channel that gets notifications via webhook. channel = new_webhook_channel("https://example.com/my_web_hook") # Store the channel, keyed by 'channel.id'. Store it before calling the # watch method because notifications may start arriving before the watch # method returns. ... resp = service.objects().watchAll( bucket="some_bucket_id", body=channel.body()).execute() channel.update(resp) # Store the channel, keyed by 'channel.id'. Store it after being updated # since the resource_id value will now be correct, and that's needed to # stop a subscription. ... An example Webhook implementation using webapp2. Note that webapp2 puts headers in a case insensitive dictionary, as headers aren't guaranteed to always be upper case. id = self.request.headers[X_GOOG_CHANNEL_ID] # Retrieve the channel by id. channel = ... # Parse notification from the headers, including validating the id. n = notification_from_headers(channel, self.request.headers) # Do app specific stuff with the notification here. if n.resource_state == 'sync': # Code to handle sync state. elif n.resource_state == 'exists': # Code to handle the exists state. elif n.resource_state == 'not_exists': # Code to handle the not exists state. Example of unsubscribing. service.channels().stop(channel.body()).execute() � )�absolute_importN)�_helpers)�errorsi� � �address�id� expiration�params�resource_id�resource_uri�type�token)r r r r � resourceId�resourceUrir r zX-GOOG-CHANNEL-IDzX-GOOG-MESSAGE-NUMBERzX-GOOG-RESOURCE-STATEzX-GOOG-RESOURCE-URIzX-GOOG-RESOURCE-IDc C s&