26 lines
564 B
Python
26 lines
564 B
Python
import asyncio
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from backend.session import session_maker
|
|
from services.billing import BillingService
|
|
|
|
|
|
async def main():
|
|
session: AsyncSession = session_maker()
|
|
|
|
try:
|
|
service = BillingService(session)
|
|
|
|
pdf_file = await service.create_billing_document_pdf(121)
|
|
|
|
with open("report.pdf", "wb") as f:
|
|
f.write(pdf_file.getvalue())
|
|
finally:
|
|
await session.close()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
loop = asyncio.get_event_loop()
|
|
loop.run_until_complete(main())
|