Skip to main content
Release file added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Canonical blog extension

This extension allows you to add a simple frontend section to your flask app. All the articles are pulled from Canonical's Wordpress back-end through the JSON API.

This extension provides a blueprint with 3 routes:

  • "/": that returns the list of articles
  • "/": the article page
  • "/feed": provides a RSS feed for the page.

Installation

To install this extension as a requirement in your project, you can use PIP;

pip3 install canonicalwebteam.blog

See also the documentation for pip install.

Usage

Local development

For local development, it's best to test this module with one of our website projects like ubuntu.com. For more information, follow this guide (internal only).

Templates

The module expects HTML templates at blog/index.html, blog/article.html, blog/blog-card.html, blog/archives.html, blog/upcoming.html and blog/author.html.

An example of these templates can be found at https://github.com/canonical-websites/jp.ubuntu.com/tree/master/templates/blog.

Usage

In your app you can then do the following:

import flask
import talisker.requests
from flask_reggie import Reggie
from canonicalwebteam.blog import BlogViews, build_blueprint, BlogAPI

app = flask.Flask(__name__)
Reggie().init_app(app)
session = talisker.requests.get_session()

blog = build_blueprint(
    BlogViews(
        api=BlogAPI(session=session),
    )
)
app.register_blueprint(blog, url_prefix="/blog")

You can customise the blog through the following optional arguments:

blog = build_blueprint(
    BlogViews(
        blog_title="Blog",
        blog_path="blog",
        tag_ids=[1, 12, 112],
        exclude_tags=[26, 34],
        per_page=12,
        feed_description="The Ubuntu Blog Feed",
        api=BlogAPI(
            session=session,
            use_image_template=True,
            thumbnail_width=330,
            thumbnail_height=185,
        ),
    )
)

Testing

All tests can be run with ./setup.py test.

Regenerating Fixtures

All API calls are caught with VCR and saved as fixtures in the fixtures directory. If the API updates, all fixtures can easily be updated by just removing the fixtures directory and rerunning the tests.

To do this run rm -rf fixtures && ./setup.py test.

Metadata

Release files for canonicalwebteam.blog 6.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for canonicalwebteam.blog 6.4.4
File Size Uploaded Provenance Actions
canonicalwebteam_blog-6.4.4.tar.gz 13.5 kB Without provenance Details for canonicalwebteam_blog-6.4.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for canonicalwebteam.blog 6.4.4
File Interpreter ABI Platform Actions
canonicalwebteam_blog-6.4.4-py3-none-any.whl Python 3 none any Details for canonicalwebteam_blog-6.4.4-py3-none-any.whl
canonicalwebteam.blog-6.4.4-py3-none-any.whl Python 3 none any Details for canonicalwebteam.blog-6.4.4-py3-none-any.whl

Total release size: 43.9 kB

Release files / canonicalwebteam_blog-6.4.4.tar.gz

Download URL canonicalwebteam_blog-6.4.4.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cc0da3f8cb9de0b28e83a1e4a1e2f7316b594d5d2e1eae349e461e1844329f68
BLAKE2b-256 checksum
How to use checksums
c21e077d7714566331ae6d821131e79bda0abc3b87653c02bf4675e33c0f410f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / canonicalwebteam_blog-6.4.4-py3-none-any.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL canonicalwebteam_blog-6.4.4-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00a1329c1992df69e0803bb0eddd4359d956cc50274c23ebcc53bf90fa91900e
BLAKE2b-256 checksum
How to use checksums
8cc0638b9091c5d911b7a1bd67b88ff9996b5f954fd962493f0700c9be45d9e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / canonicalwebteam.blog-6.4.4-py3-none-any.whl

Download URL canonicalwebteam.blog-6.4.4-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bf352e13fedc5bdc3ffa251ce6a70d655d078a71b65bc55f6e6df008b2199fb
BLAKE2b-256 checksum
How to use checksums
91beac353fbec7b29db83b7e00d2f3578e597832e2c71c3b7ea90c7a33869137
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Security for canonicalwebteam.blog 6.4.4

Upload timing

Release file added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.


Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.4.4 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page