platypush.plugins.http.request

class platypush.plugins.http.request.HttpRequestPlugin(**kwargs)[source]

Plugin for executing custom HTTP requests.

Requires:

  • requests (pip install 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"
        }
    }
}
__init__(**kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

delete(url, **kwargs)[source]

Perform a DELETE request

Parameters:
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:
head(url, **kwargs)[source]

Perform an HTTP HEAD request

Parameters:
options(url, **kwargs)[source]

Perform an HTTP OPTIONS request

Parameters:
post(url, **kwargs)[source]

Perform a POST request

Parameters:
put(url, **kwargs)[source]

Perform a PUT request

Parameters: