aleaforny/python-invoice-generator: Little and simple-to-use library to use Bill Generator API with Python

Smaller and easy-to-use library to use Invoice Generator API with Python.

You can uncover far more data on https://bill-generator.com/ (i am not the operator of it). This API is extremely good and permit you to create invoices on the fly conveniently with a lot of customization.

Stipulations

Put in the offers from https://github.com/Invoiced/bill-generator-api/ and follow its instruction.

Code disclaimer

  • This is NOT a Python package, just a quite smaller library at its early phase. I produced it for my have use, but it can perhaps enable some other time, and it can be improved in many ways, so sense cost-free to input your additions!
  • You can customise some of the class attribute, this kind of as the day structure on the bill, locale or timezone.
  • The file payload is accessible by using reaction.written content, if the response position code is 200.
  • Possibly you mentioned also that the unique API parameter from had to be modified to sender in this library. This is owing to the actuality that from can not be a parameter in Python as it truly is a key word, but the location is properly renamed right after becoming passed as a JSON string when contacting the API.
  • Read through Invoice Generator API docs for entire being familiar with of the API and the parameters available. Not ALL paramaters have been analyzed with this API, so there can be some bugs!

How-to-use (By example)

The code is documented and there are no diverse endpoints with this API so there are no so numerous procedures.

  1. Build the Bill item
bill = InvoiceGenerator(
    sender="Invoiced, Inc.",
    to="Parag",
    logo="https://invoiced.com/img/logo-invoice.png",
    variety=1,
    notes="Many thanks for your business enterprise!",
    shipping and delivery=50
)
  1. Increase a single or various products to it
bill.include_merchandise(
    title="Starter program",
    quantity=1,
    device_price tag=99,
)
invoice.add_merchandise(
    name="Fees",
    quantity=1,
    device_price=49,
)
  1. You can fundamentally customise the object soon after hand (helpful if you have to course of action items following making the invoice but right before essentially sending it, most likely for some async tasks…)
bill.toggle_subtotal(delivery=True)
  1. At last obtain the file (this will essentially phone the API). It can be complete or relative path.
invoice.obtain("my-wonderful-bill.pdf")