repos: 209091256
This data as json
id | node_id | name | full_name | private | owner | html_url | description | fork | created_at | updated_at | pushed_at | homepage | size | stargazers_count | watchers_count | language | has_issues | has_projects | has_downloads | has_wiki | has_pages | forks_count | archived | disabled | open_issues_count | license | topics | forks | open_issues | watchers | default_branch | permissions | temp_clone_token | organization | network_count | subscribers_count | readme | readme_html | allow_forking | visibility | is_template | template_repository | web_commit_signoff_required | has_discussions |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
209091256 | MDEwOlJlcG9zaXRvcnkyMDkwOTEyNTY= | datasette-atom | simonw/datasette-atom | 0 | 9599 | https://github.com/simonw/datasette-atom | Datasette plugin that adds a .atom output format | 0 | 2019-09-17T15:31:01Z | 2021-03-26T02:06:51Z | 2021-01-24T23:59:36Z | 47 | 10 | 10 | Python | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | apache-2.0 | ["datasette", "datasette-plugin", "datasette-io"] | 0 | 0 | 10 | main | {"admin": false, "push": false, "pull": false} | 0 | 2 | # datasette-atom [](https://pypi.org/project/datasette-atom/) [](https://github.com/simonw/datasette-atom/releases) [](https://github.com/simonw/datasette-atom/actions?query=workflow%3ATest) [](https://github.com/simonw/datasette-atom/blob/main/LICENSE) Datasette plugin that adds support for generating [Atom feeds](https://validator.w3.org/feed/docs/atom.html) 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](https://web.archive.org/web/20080211143232/http://diveintomark.org/archives/2004/05/28/howto-atom-id) has suggestions about ways to create these IDs. * `atom_title` - a title for that row. * `atom_updated` - an [RFC 3339](http://www.faqs.org/rfcs/rfc3339.html) timestamp representing the last time the entry was modified in a significant way. This can usually be the time that the row was created. The following columns are optional: * `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. * `atom_content_html` - content that should be shown in the feed. This will be treated as an HTML string, and will be sanitized using [Bleach](https://github.com/mozilla/bleach) to ensure it does not have any malicious code in it before being returned as part of a `<content type="html">` Atom element. If both are provided, this will be used in place of `atom_content`. * `atom_link` - a URL that should be used as the link that the feed entry points to. * `atom_author_name` - the name of the author of the entry. If you provide this you can also provide `atom_author_uri` and `atom_author_email` with a URL and e-mail address for that author. 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](https://www.niche-museums.com/): ```sql 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, coalesce( '<img src="' || photo_url || '?w=800&h=400&fit=crop&auto=compress">', '' ) || '<p>' || description || '</p>' as atom_content_html from museums order by created desc limit 15 ``` You can try this query by [pasting it in here](https://www.niche-museums.com/browse) - then click the `.atom` link to see it as an Atom feed. ## Using a canned query Datasette's [canned query mechanism](https://docs.datasette.io/en/stable/sql_queries.html#canned-queries) is a useful way to configure feeds. If a canned query definition has a `title` that will be used as the title of the Atom feed. Here's an example, defined using a `metadata.yaml` file: ```yaml databases: browse: queries: feed: title: Niche Museums sql: |- 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, coalesce( '<img src="' || photo_url || '?w=800&h=400&fit=crop&auto=compress">', '' ) || '<p>' || description || '</p>' as atom_content_html from museums order by created desc limit 15 ``` ## Disabling HTML filtering The HTML allow-list used by Bleach for the `atom_content_html` column can be found in the `clean(html)` function at the bottom of [datasette_atom/__init__.py](https://github.com/simonw/datasette-atom/blob/main/datasette_atom/__init__.py). You can disable Bleach entirely for Atom feeds generated using a canned query. You should only do this if you are certain that no user-provided HTML could be included in that value. Here's how to do that in `metadata.json`: ```json { "plugins": { "datasette-atom": { "allow_unsafe_html_in_canned_queries": true } } } ``` Setting this to `true` will disable Bleach filtering for all canned queries across all databases. You can disable Bleach filtering just for a specific list of canned queries like so: ```json { "plugins": { "datasette-atom": { "allow_unsafe_html_in_canned_queries": { "museums": ["latest", "moderation"] } } } } ``` This will disable Bleach just for the canned queries called `latest` and `moderation` in the `museums.db` database. | <div id="readme" class="md" data-path="README.md"><article class="markdown-body entry-content container-lg" itemprop="text"><h1><a id="user-content-datasette-atom" class="anchor" aria-hidden="true" href="#user-content-datasette-atom"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>datasette-atom</h1> <p><a href="https://pypi.org/project/datasette-atom/" rel="nofollow"><img src="https://camo.githubusercontent.com/7957f60f0a749eb9a6313a3c35574dad2554ed586ef3bd67c4f0b768edd28fb2/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6461746173657474652d61746f6d2e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/datasette-atom.svg" style="max-width:100%;"></a> <a href="https://github.com/simonw/datasette-atom/releases"><img src="https://camo.githubusercontent.com/42a02d342f39e3dc05195df216b9f89fa84de19d94547b4c68a02ec12f0eaf2d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73696d6f6e772f6461746173657474652d61746f6d3f696e636c7564655f70726572656c6561736573266c6162656c3d6368616e67656c6f67" alt="Changelog" data-canonical-src="https://img.shields.io/github/v/release/simonw/datasette-atom?include_prereleases&label=changelog" style="max-width:100%;"></a> <a href="https://github.com/simonw/datasette-atom/actions?query=workflow%3ATest"><img src="https://github.com/simonw/datasette-atom/workflows/Test/badge.svg" alt="Tests" style="max-width:100%;"></a> <a href="https://github.com/simonw/datasette-atom/blob/main/LICENSE"><img src="https://camo.githubusercontent.com/1698104e976c681143eb0841f9675c6f802bb7aa832afc0c7a4e719b1f3cf955/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" style="max-width:100%;"></a></p> <p>Datasette plugin that adds support for generating <a href="https://validator.w3.org/feed/docs/atom.html" rel="nofollow">Atom feeds</a> with the results of a SQL query.</p> <h2><a id="user-content-installation" class="anchor" aria-hidden="true" href="#user-content-installation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Installation</h2> <p>Install this plugin in the same environment as Datasette to enable the <code>.atom</code> output extension.</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="$ pip install datasette-atom "><pre><code>$ pip install datasette-atom </code></pre></div> <h2><a id="user-content-usage" class="anchor" aria-hidden="true" href="#user-content-usage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Usage</h2> <p>To create an Atom feed you need to define a custom SQL query that returns a required set of columns:</p> <ul> <li><code>atom_id</code> - a unique ID for each row. <a href="https://web.archive.org/web/20080211143232/http://diveintomark.org/archives/2004/05/28/howto-atom-id" rel="nofollow">This article</a> has suggestions about ways to create these IDs.</li> <li><code>atom_title</code> - a title for that row.</li> <li><code>atom_updated</code> - an <a href="http://www.faqs.org/rfcs/rfc3339.html" rel="nofollow">RFC 3339</a> timestamp representing the last time the entry was modified in a significant way. This can usually be the time that the row was created.</li> </ul> <p>The following columns are optional:</p> <ul> <li><code>atom_content</code> - 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.</li> <li><code>atom_content_html</code> - content that should be shown in the feed. This will be treated as an HTML string, and will be sanitized using <a href="https://github.com/mozilla/bleach">Bleach</a> to ensure it does not have any malicious code in it before being returned as part of a <code><content type="html"></code> Atom element. If both are provided, this will be used in place of <code>atom_content</code>.</li> <li><code>atom_link</code> - a URL that should be used as the link that the feed entry points to.</li> <li><code>atom_author_name</code> - the name of the author of the entry. If you provide this you can also provide <code>atom_author_uri</code> and <code>atom_author_email</code> with a URL and e-mail address for that author.</li> </ul> <p>A query that returns these columns can then be returned as an Atom feed by adding the <code>.atom</code> extension.</p> <h2><a id="user-content-example" class="anchor" aria-hidden="true" href="#user-content-example"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Example</h2> <p>Here is an example SQL query which generates an Atom feed for new entries on <a href="https://www.niche-museums.com/" rel="nofollow">www.niche-museums.com</a>:</p> <div class="highlight highlight-source-sql position-relative" data-snippet-clipboard-copy-content="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, coalesce( '<img src="' || photo_url || '?w=800&amp;h=400&amp;fit=crop&amp;auto=compress">', '' ) || '<p>' || description || '</p>' as atom_content_html from museums order by created desc limit 15 "><pre><span class="pl-k">select</span> <span class="pl-s"><span class="pl-pds">'</span>tag:niche-museums.com,<span class="pl-pds">'</span></span> <span class="pl-k">||</span> substr(created, <span class="pl-c1">0</span>, <span class="pl-c1">11</span>) <span class="pl-k">||</span> <span class="pl-s"><span class="pl-pds">'</span>:<span class="pl-pds">'</span></span> <span class="pl-k">||</span> id <span class="pl-k">as</span> atom_id, name <span class="pl-k">as</span> atom_title, created <span class="pl-k">as</span> atom_updated, <span class="pl-s"><span class="pl-pds">'</span>https://www.niche-museums.com/browse/museums/<span class="pl-pds">'</span></span> <span class="pl-k">||</span> id <span class="pl-k">as</span> atom_link, coalesce( <span class="pl-s"><span class="pl-pds">'</span><img src="<span class="pl-pds">'</span></span> <span class="pl-k">||</span> photo_url <span class="pl-k">||</span> <span class="pl-s"><span class="pl-pds">'</span>?w=800&amp;h=400&amp;fit=crop&amp;auto=compress"><span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span> ) <span class="pl-k">||</span> <span class="pl-s"><span class="pl-pds">'</span><p><span class="pl-pds">'</span></span> <span class="pl-k">||</span> description <span class="pl-k">||</span> <span class="pl-s"><span class="pl-pds">'</span></p><span class="pl-pds">'</span></span> <span class="pl-k">as</span> atom_content_html <span class="pl-k">from</span> museums <span class="pl-k">order by</span> created <span class="pl-k">desc</span> <span class="pl-k">limit</span> <span class="pl-c1">15</span></pre></div> <p>You can try this query by <a href="https://www.niche-museums.com/browse" rel="nofollow">pasting it in here</a> - then click the <code>.atom</code> link to see it as an Atom feed.</p> <h2><a id="user-content-using-a-canned-query" class="anchor" aria-hidden="true" href="#user-content-using-a-canned-query"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Using a canned query</h2> <p>Datasette's <a href="https://docs.datasette.io/en/stable/sql_queries.html#canned-queries" rel="nofollow">canned query mechanism</a> is a useful way to configure feeds. If a canned query definition has a <code>title</code> that will be used as the title of the Atom feed.</p> <p>Here's an example, defined using a <code>metadata.yaml</code> file:</p> <div class="highlight highlight-source-yaml position-relative" data-snippet-clipboard-copy-content="databases: browse: queries: feed: title: Niche Museums sql: |- 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, coalesce( '<img src="' || photo_url || '?w=800&amp;h=400&amp;fit=crop&amp;auto=compress">', '' ) || '<p>' || description || '</p>' as atom_content_html from museums order by created desc limit 15 "><pre><span class="pl-ent">databases</span>: <span class="pl-ent">browse</span>: <span class="pl-ent">queries</span>: <span class="pl-ent">feed</span>: <span class="pl-ent">title</span>: <span class="pl-s">Niche Museums</span> <span class="pl-ent">sql</span>: <span class="pl-s">|-</span> <span class="pl-s"> select</span> <span class="pl-s"> 'tag:niche-museums.com,' || substr(created, 0, 11) || ':' || id as atom_id,</span> <span class="pl-s"> name as atom_title,</span> <span class="pl-s"> created as atom_updated,</span> <span class="pl-s"> 'https://www.niche-museums.com/browse/museums/' || id as atom_link,</span> <span class="pl-s"> coalesce(</span> <span class="pl-s"> '<img src="' || photo_url || '?w=800&amp;h=400&amp;fit=crop&amp;auto=compress">',</span> <span class="pl-s"> ''</span> <span class="pl-s"> ) || '<p>' || description || '</p>' as atom_content_html</span> <span class="pl-s"> from</span> <span class="pl-s"> museums</span> <span class="pl-s"> order by</span> <span class="pl-s"> created desc</span> <span class="pl-s"> limit</span> <span class="pl-s"> 15</span></pre></div> <h2><a id="user-content-disabling-html-filtering" class="anchor" aria-hidden="true" href="#user-content-disabling-html-filtering"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Disabling HTML filtering</h2> <p>The HTML allow-list used by Bleach for the <code>atom_content_html</code> column can be found in the <code>clean(html)</code> function at the bottom of <a href="https://github.com/simonw/datasette-atom/blob/main/datasette_atom/__init__.py">datasette_atom/<strong>init</strong>.py</a>.</p> <p>You can disable Bleach entirely for Atom feeds generated using a canned query. You should only do this if you are certain that no user-provided HTML could be included in that value.</p> <p>Here's how to do that in <code>metadata.json</code>:</p> <div class="highlight highlight-source-json position-relative" data-snippet-clipboard-copy-content="{ "plugins": { "datasette-atom": { "allow_unsafe_html_in_canned_queries": true } } } "><pre>{ <span class="pl-s"><span class="pl-pds">"</span>plugins<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>datasette-atom<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>allow_unsafe_html_in_canned_queries<span class="pl-pds">"</span></span>: <span class="pl-c1">true</span> } } }</pre></div> <p>Setting this to <code>true</code> will disable Bleach filtering for all canned queries across all databases.</p> <p>You can disable Bleach filtering just for a specific list of canned queries like so:</p> <div class="highlight highlight-source-json position-relative" data-snippet-clipboard-copy-content="{ "plugins": { "datasette-atom": { "allow_unsafe_html_in_canned_queries": { "museums": ["latest", "moderation"] } } } } "><pre>{ <span class="pl-s"><span class="pl-pds">"</span>plugins<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>datasette-atom<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>allow_unsafe_html_in_canned_queries<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>museums<span class="pl-pds">"</span></span>: [<span class="pl-s"><span class="pl-pds">"</span>latest<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>moderation<span class="pl-pds">"</span></span>] } } } }</pre></div> <p>This will disable Bleach just for the canned queries called <code>latest</code> and <code>moderation</code> in the <code>museums.db</code> database.</p> </article></div> |
Links from other tables
- 11 rows from repo in releases