Datasette plugin that adds a .atom output format
Project description
datasette-atom
Datasette plugin that adds support for generating Atom feeds with the results of a SQL query.
Installation
Install this plugin in the same environment as Datasette to enable the .atom
output extension.
$ pip install datasette-atom
Usage
To create an Atom feed you need to define a custom SQL query that returns a required set of columns:
atom_id
- a unique ID for each row. This article has suggestions about ways to create these IDs.atom_title
- a title for that row.atom_updated
- an RFC 3339 timestamp representing the last time the entry was modified in a significant way. This can usually be the time that the row was created.atom_content
- content that should be shown in the feed. This will be treated as a regular string, so any embedded HTML tags will be escaped when they are displayed.
You can also return an optional atom_link
column, which will be used as a URL that the entry in the feed links to.
A query that returns these columns can then be returned as an Atom feed by adding the .atom
extension.
Example
Here is an example SQL query which generates an Atom feed for new entries on www.niche-museums.com:
select
'tag:niche-museums.com,' || substr(created, 0, 11) || ':' || id as atom_id,
name as atom_title,
created as atom_updated,
'https://www.niche-museums.com/browse/museums/' || id as atom_link,
description as atom_content
from
museums
order by
created desc
limit 15
You can try the query here. Here is the atom feed that is generated when you swap in the .atom
extension.
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 Distributions
Built Distribution
Hashes for datasette_atom-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7877b0271f70978ceeb57dbed13957542be40982e86557bfd80a495d7f79a87d |
|
MD5 | dee12357da984c5bc751bc46c5b0ae73 |
|
BLAKE2b-256 | 761547a9661b0648075045a13183b7c12458466a7d6459ca137cef9b05ce9dc7 |