datasette-proxy-url by datasette

20 downloads this week        Star

README source code

datasette-proxy-url

PyPI Changelog Tests License

Proxy a URL through a Datasette instance

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-proxy-url

Usage

This plugin can be configured to set specific paths within Datasette to proxy content from another URL.

Configure the plugin like this:

{
    "plugins": {
        "datasette-proxy-url": {
            "paths": [
                {"path": "/proxy", "backend": "http://example.com/"},
            ]
        }
    }
}

Now any request to /proxy will serve the HTML content from http://example.com/.

The content-type response header and the content body will be passed through. All other headers are currently ignored.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-proxy-url
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest