http.request
Platypush documentation
http.request
- class platypush.plugins.http.request.HttpRequestPlugin(**kwargs)[source]
Bases:
Plugin
Plugin for executing custom HTTP requests.
Some example usages:
# Execute a GET request on a JSON endpoint { "type": "request", "action": "http.request.get", "args": { "url": "http://remote-host/api/v1/entity", "params": { "start": "2000-01-01" } } } # Execute an action on another Platypush host through HTTP interface { "type": "request", "action": "http.request.post", "args": { "url": "http://remote-host:8008/execute", "json": { "type": "request", "target": "remote-host", "action": "music.mpd.play" } } }
- delete(url, **kwargs)[source]
Perform a DELETE request
- Parameters:
url (str) – Target URL
kwargs (dict) – Additional arguments that will be transparently provided to the
requests
object, including but not limited to query params, data, JSON, headers etc. (see https://docs.python-requests.org/en/master/user/quickstart/#make-a-request)
- download(url: str, path: str, **kwargs)[source]
Locally download the content of a remote URL.
- Parameters:
url – URL to be downloaded.
path – Path where the content will be downloaded on the local filesystem - must be a file name.
- get(url, **kwargs)[source]
Perform a GET request
- Parameters:
url (str) – Target URL
kwargs (dict) – Additional arguments that will be transparently provided to the
requests
object, including but not limited to query params, data, JSON, headers etc. (see https://docs.python-requests.org/en/master/user/quickstart/#make-a-request)
- head(url, **kwargs)[source]
Perform an HTTP HEAD request
- Parameters:
url (str) – Target URL
kwargs (dict) – Additional arguments that will be transparently provided to the
requests
object, including but not limited to query params, data, JSON, headers etc. (see https://docs.python-requests.org/en/master/user/quickstart/#make-a-request)
- options(url, **kwargs)[source]
Perform an HTTP OPTIONS request
- Parameters:
url (str) – Target URL
kwargs (dict) – Additional arguments that will be transparently provided to the
requests
object, including but not limited to query params, data, JSON, headers etc. (see https://docs.python-requests.org/en/master/user/quickstart/#make-a-request)
- post(url, **kwargs)[source]
Perform a POST request
- Parameters:
url (str) – Target URL
kwargs (dict) – Additional arguments that will be transparently provided to the
requests
object, including but not limited to query params, data, JSON, headers etc. (see https://docs.python-requests.org/en/master/user/quickstart/#make-a-request)
- put(url, **kwargs)[source]
Perform a PUT request
- Parameters:
url (str) – Target URL
kwargs (dict) – Additional arguments that will be transparently provided to the
requests
object, including but not limited to query params, data, JSON, headers etc. (see https://docs.python-requests.org/en/master/user/quickstart/#make-a-request)