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.
(self)
| 207 | self.resource_uri = resource_uri |
| 208 | |
| 209 | def body(self): |
| 210 | """Build a body from the Channel. |
| 211 | |
| 212 | Constructs a dictionary that's appropriate for passing into watch() |
| 213 | methods as the value of body argument. |
| 214 | |
| 215 | Returns: |
| 216 | A dictionary representation of the channel. |
| 217 | """ |
| 218 | result = { |
| 219 | "id": self.id, |
| 220 | "token": self.token, |
| 221 | "type": self.type, |
| 222 | "address": self.address, |
| 223 | } |
| 224 | if self.params: |
| 225 | result["params"] = self.params |
| 226 | if self.resource_id: |
| 227 | result["resourceId"] = self.resource_id |
| 228 | if self.resource_uri: |
| 229 | result["resourceUri"] = self.resource_uri |
| 230 | if self.expiration: |
| 231 | result["expiration"] = self.expiration |
| 232 | |
| 233 | return result |
| 234 | |
| 235 | def update(self, resp): |
| 236 | """Update a channel with information from the response of watch(). |