Name | datasette-remote-actors JSON |
Version |
0.1a2
JSON |
| download |
home_page | |
Summary | Datasette plugin for fetching details of actors from a remote endpoint |
upload_time | 2023-09-28 05:07:57 |
maintainer | |
docs_url | None |
author | Simon Willison |
requires_python | |
license | Apache-2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# datasette-remote-actors
[![PyPI](https://img.shields.io/pypi/v/datasette-remote-actors.svg)](https://pypi.org/project/datasette-remote-actors/)
[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-remote-actors?include_prereleases&label=changelog)](https://github.com/datasette/datasette-remote-actors/releases)
[![Tests](https://github.com/datasette/datasette-remote-actors/workflows/Test/badge.svg)](https://github.com/datasette/datasette-remote-actors/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-remote-actors/blob/main/LICENSE)
A Datasette plugin for fetching details of actors from a remote endpoint. See [#2180](https://github.com/simonw/datasette/issues/2180) for details.
## Installation
```bash
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:
```json
{
"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
```yaml
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:
```bash
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
```
Raw data
{
"_id": null,
"home_page": "",
"name": "datasette-remote-actors",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Simon Willison",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/e4/6d/ad00cf4871bd3d3cf1cbcf20bca6159c990b028d775a1740590b45830c4f/datasette-remote-actors-0.1a2.tar.gz",
"platform": null,
"description": "# datasette-remote-actors\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-remote-actors.svg)](https://pypi.org/project/datasette-remote-actors/)\n[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-remote-actors?include_prereleases&label=changelog)](https://github.com/datasette/datasette-remote-actors/releases)\n[![Tests](https://github.com/datasette/datasette-remote-actors/workflows/Test/badge.svg)](https://github.com/datasette/datasette-remote-actors/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-remote-actors/blob/main/LICENSE)\n\nA Datasette plugin for fetching details of actors from a remote endpoint. See [#2180](https://github.com/simonw/datasette/issues/2180) for details.\n\n## Installation\n\n```bash\ndatasette install datasette-remote-actors\n```\n\n## API endpoint\n\nYou must configure this plugin with a URL to an endpoint that returns JSON data about actors.\n\nThe endpoint should accept a comma separated list of IDs `?ids=1,2,3` and return a JSON dictionary that looks like this:\n\n```json\n{\n \"1\": {\n \"id\": \"1\",\n \"name\": \"Name 1\",\n },\n \"2\": {\n \"id\": \"2\",\n \"name\": \"Name 2\",\n }\n}\n```\nAside from requiring an ID (which can be a string or an integer) the content of that actor dictionary is entirely up to the implementor.\n\nIf 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.\n\n## Configuration\n\n```yaml\nplugins:\n datasette-remote-actors:\n ttl: 60\n url: https://example.com/actors.json\n token: xxx\n```\nThe `url` is required, the others are optional.\n\n- `url` - the URL to the endpoint that can resolve actor IDs into JSON actor dictionaries\n- `ttl` - the number of seconds to cache the result for a specific actor - omit this for no caching\n- `token` - an optional token to be sent in the `Authorization: Bearer xxx` header for authentication\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd datasette-remote-actors\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```\npip install -e '.[test]'\n```\n```\nTo run the tests:\n```bash\npytest\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Datasette plugin for fetching details of actors from a remote endpoint",
"version": "0.1a2",
"project_urls": {
"CI": "https://github.com/datasette/datasette-remote-actors/actions",
"Changelog": "https://github.com/datasette/datasette-remote-actors/releases",
"Homepage": "https://github.com/datasette/datasette-remote-actors",
"Issues": "https://github.com/datasette/datasette-remote-actors/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e64a60673b3ca11d2096e652468285c5b3a4f00f3f81309f4b6e1ab8d84bc639",
"md5": "4956f41a6a39c78c4b9ca1f0d75a02f8",
"sha256": "58c2bc7da42b3c3c2d4ebac6cd14243fa3a2fe3ed97a10c331bff095577975e4"
},
"downloads": -1,
"filename": "datasette_remote_actors-0.1a2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4956f41a6a39c78c4b9ca1f0d75a02f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7571,
"upload_time": "2023-09-28T05:07:55",
"upload_time_iso_8601": "2023-09-28T05:07:55.458158Z",
"url": "https://files.pythonhosted.org/packages/e6/4a/60673b3ca11d2096e652468285c5b3a4f00f3f81309f4b6e1ab8d84bc639/datasette_remote_actors-0.1a2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e46dad00cf4871bd3d3cf1cbcf20bca6159c990b028d775a1740590b45830c4f",
"md5": "d62322cc7730c1f586e72243e278b857",
"sha256": "516aa9969be7288c4ba03595966bf01896c39911cc20f99b7de815177211ab54"
},
"downloads": -1,
"filename": "datasette-remote-actors-0.1a2.tar.gz",
"has_sig": false,
"md5_digest": "d62322cc7730c1f586e72243e278b857",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7494,
"upload_time": "2023-09-28T05:07:57",
"upload_time_iso_8601": "2023-09-28T05:07:57.000433Z",
"url": "https://files.pythonhosted.org/packages/e4/6d/ad00cf4871bd3d3cf1cbcf20bca6159c990b028d775a1740590b45830c4f/datasette-remote-actors-0.1a2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-28 05:07:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "datasette",
"github_project": "datasette-remote-actors",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "datasette-remote-actors"
}