Datasette plugin for fetching details of actors from a remote endpoint
Project description
datasette-remote-actors
A Datasette plugin for fetching details of actors from a remote endpoint. See #2180 for details.
Installation
datasette install datasette-remote-actors
API endpoint
You must configure this plugin with a URL to an endpoint that returns JSON data about actors.
The endpoint 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 dictionariesttl
- the number of seconds to cache the result for a specific actor - omit this for no cachingtoken
- an optional token to be sent in theAuthorization: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file datasette-remote-actors-0.1a2.tar.gz
.
File metadata
- Download URL: datasette-remote-actors-0.1a2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 516aa9969be7288c4ba03595966bf01896c39911cc20f99b7de815177211ab54 |
|
MD5 | d62322cc7730c1f586e72243e278b857 |
|
BLAKE2b-256 | e46dad00cf4871bd3d3cf1cbcf20bca6159c990b028d775a1740590b45830c4f |
File details
Details for the file datasette_remote_actors-0.1a2-py3-none-any.whl
.
File metadata
- Download URL: datasette_remote_actors-0.1a2-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58c2bc7da42b3c3c2d4ebac6cd14243fa3a2fe3ed97a10c331bff095577975e4 |
|
MD5 | 4956f41a6a39c78c4b9ca1f0d75a02f8 |
|
BLAKE2b-256 | e64a60673b3ca11d2096e652468285c5b3a4f00f3f81309f4b6e1ab8d84bc639 |