http#

Description#

Plugin for executing custom HTTP requests.

Some example usages:

# Execute a GET request on a JSON endpoint
{
    "type": "request",
    "action": "http.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.post",
    "args": {
        "url": "http://remote-host:8008/execute",
        "json": {
            "type": "request",
            "target": "remote-host",
            "action": "music.mpd.play"
        }
    }
}

Configuration#

http:
    # No configuration required

Actions#

Module reference#

class platypush.plugins.http.HttpPlugin(**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.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.post",
    "args": {
        "url": "http://remote-host:8008/execute",
        "json": {
            "type": "request",
            "target": "remote-host",
            "action": "music.mpd.play"
        }
    }
}
__init__(**kwargs)[source]#
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: