0 purchases
reportobello 0.2.0
Reportobello
Python API library for Reportobello.
Installing
$ pip install reportobello
Basic Usage
Below is a full exmaple of how to create reports in Reportobello.
This example is ready to go, and can be copy-pasted into your project.
from dataclasses import dataclass
import asyncio
from reportobello import ReportobelloApi, Template
@dataclass
class QuarterlyReport(Template):
name = "quarterly_report"
# See Typst docs for syntax: https://typst.app/docs
content = """
#let data = json("data.json")
= Q#data.quarter Earnings Report
Generated: #datetime.today().display()
Earnings: #data.earnings
"""
# Alternatively, store in a file
# file = "report.typ"
quarter: int
earnings: float
api = ReportobelloApi()
async def main():
template = QuarterlyReport(quarter=1, earnings=123_456)
# You only need to run this if the template above changes
await api.create_or_update_template(template)
pdf = await api.build_template(template)
print(f"Downloading {pdf.url}")
await pdf.save_to("output.pdf")
asyncio.run(main())
Read the docs for more info.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.