platypush.backend.http.poll
¶
-
class
platypush.backend.http.poll.
HttpPollBackend
(requests, *args, **kwargs)[source]¶ This backend will poll multiple HTTP endpoints/services and return events the bus whenever something new happened. Supported types:
platypush.backend.http.request.JsonHttpRequest
(for polling updates on a JSON endpoint),platypush.backend.http.request.rss.RssUpdates
(for polling updates on an RSS feed). Example configuration:backend.http.poll: requests: - # Poll for updates on a JSON endpoint method: GET type: platypush.backend.http.request.JsonHttpRequest args: url: https://host.com/api/v1/endpoint headers: Token: TOKEN params: updatedSince: 1m timeout: 5 # Times out after 5 seconds (default) poll_seconds: 60 # Check for updates on this endpoint every 60 seconds (default) path: ${response['items']} # Path in the JSON to check for new items. # Python expressions are supported. # Note that 'response' identifies the JSON root. # Default value: JSON root. - # Poll for updates on an RSS feed type: platypush.backend.http.request.rss.RssUpdates url: http://www.theguardian.com/rss/world title: The Guardian - World News poll_seconds: 120 max_entries: 10
Triggers: an update event for the relevant HTTP source if it contains new items. For example:
platypush.message.event.http.rss.NewFeedEvent
if a feed contains new itemsplatypush.message.event.http.HttpEvent
if a JSON endpoint contains new items