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 hashes)