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
Hashes for datasette-remote-actors-0.1a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 924edcb1afbc1f5ea946df4d7d6de43101af25968e0e44ebf11c7f4e0139c7cc |
|
MD5 | 5d374a86518698a58cc764c74ec022c1 |
|
BLAKE2b-256 | 6e52507f1bd8f49f005c0837e77138eee2c78edc6f27d74747dffc3a727fa690 |
Hashes for datasette_remote_actors-0.1a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8421d6b8c128b31a598c67af653bf44babdfa9b1ee5880df9d7b62c72b9af87 |
|
MD5 | 5f78f6d944a2062fd31dbc1327064554 |
|
BLAKE2b-256 | 28c559829e3c221e00b129776c33c0bde8428c68a4d236b0555344de30aefe47 |