Skip to main content

Datasette plugin for fetching details of actors from a remote endpoint

Project description

datasette-remote-actors

PyPI Changelog Tests License

A Datasette plugin for fetching details of actors from a remote endpoint.

Installation

datasette install datasette-remote-actors

Necessary endpoint

You must configure this plugin with a URL that returns JSON data about actors.

The URL should accept a comma separated list of IDs ?ids=1,2,3 and return a JSON dictionary that looks like this:

{
  "1": {
    "id": "1",
    "name": "Name 1",
  },
  "2": {
    "id": "2",
    "name": "Name 2",
  }
}

Aside from requiring an ID (which can be a string or an integer) the content of that actor dictionary is entirely up to the implementor.

If you only have a small number of actors your endpoint could ignore the ?ids= parameter and return all of the actors in one go. They will be cached by the plugin and used to serve future requests.

Configuration

plugins:
  datasette-remote-actors:
    ttl: 60
    url: https://example.com/actors.json
    token: xxx

The url is required, the others are optional.

  • url - the URL to the endpoint that can resolve actor IDs into JSON actor dictionaries
  • ttl - the number of seconds to cache the result for a specific actor - omit this for no caching
  • token - an optional token to be sent in the Authorization: Bearer xxx header for authentication

Development

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

cd datasette-remote-actors
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'
To run the tests:
```bash
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette-remote-actors-0.1a0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

datasette_remote_actors-0.1a0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file datasette-remote-actors-0.1a0.tar.gz.

File metadata

File hashes

Hashes for datasette-remote-actors-0.1a0.tar.gz
Algorithm Hash digest
SHA256 9f36150e3b108749a80bca4f014012a7253643f8568121bfdb01501086d5a153
MD5 68d7d0050c2b67f3899faba4727e7cb1
BLAKE2b-256 4ab198db9b629a9fd96307cf4583251260a5bdcf778a7a48d74ba96e322c0143

See more details on using hashes here.

File details

Details for the file datasette_remote_actors-0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_remote_actors-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 3205efab857604e06a3bd57b72bfaa4e449f469065cf137a3ba994b82c46e9d8
MD5 b26ca1dcc9a7885488b699f80c4548dc
BLAKE2b-256 e730d2fd2becdf7e491edcf13b7604207db2ec2bf6850fab89cae2f57d59130c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page