A Murasaki API wrapper.
Project description
A simple API wrapper for Newsworthy's template writer, https://jplusplus-murasaki.herokuapp.com/
Installation
pip install murasaki
Usage
from murasaki import Murasaki
murasaki = Murasaki("https://jplusplus-murasaki.herokuapp.com/", language="sv-SE", timezone="Europe/Stockholm")
context_data = {
"region": "Tjörns kommun",
}
template = """
| Ovanligt varmt #{ territoryShort(region), "locative" } i går
"""
murasaki.pug(context_data, template)
'Ovanligt varmt på Tjörn i går'
template = "Ovanligt varmt {{ territoryShort(region), 'locative' }} i går"
murasaki.mustache(context_data, template)
'Ovanligt varmt på Tjörn i går'
By default we will look for user credentials in MURASAKI_USER
and MURASAKI_PWD
respectively.
They can also be set using the user
and password
arguments.
Methods
- constructor(API_endpoint, language=None, timezone=None, user=process.env.MURASAKI_USER, password=process.env.MURASAKI_PWD)
- .pug(data, template) Render a pug template
- .pugz(data, template) Render a gzipped pug template
- .javascript(data, template) Render a ECMAScript template literal
- .mustache(data, template) Render a Mustache template
Changelog
-
1.0.1
- Make language and timezone work properly
-
1.0.0
- First version
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
murasaki-1.0.1.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file murasaki-1.0.1.tar.gz
.
File metadata
- Download URL: murasaki-1.0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f22f938c034d83cf544a25d7ed538350ca19ca7d74a2407b042541ae7446d48 |
|
MD5 | 6f2bd71cb8e1576390c00da1a7a7ad7e |
|
BLAKE2b-256 | 3ab692a2794a0d0a1f617817021e419e7694391c664d1df1cbe39b078fdc5cda |
File details
Details for the file murasaki-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: murasaki-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2bc2aba9c1a1d0f3a9a0749d27c05fb45c707ef64d34f0c2451db66bebf6a20 |
|
MD5 | aea348c1e326b6e6d4a7fb039236b1c1 |
|
BLAKE2b-256 | bc18060d1f921fbddd4ff76c0ce60a3bca322626677f0b97eb39106a01ce4177 |