Giter Club home page Giter Club logo

python-invoice-generator's Introduction

python-invoice-generator

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

You can find more info on https://invoice-generator.com/ (i'm not the owner of it). This API is very nice and allow you to generate invoices on the fly easily with a lot of customization.

Prerequisites

Install the packages from https://github.com/Invoiced/invoice-generator-api/ and follow its instruction.

Code disclaimer

  • This is NOT a Python package, just a very small library at its early stage. I created it for my own use, but it can perhaps help some other time, and it can be improved in many ways, so feel free to input your additions!
  • You can customize some of the class attribute, such as the date format on the invoice, locale or timezone.
  • The file payload is accessible via response.content, if the response status code is 200.
  • Perhaps you noted also that the original API parameter from had to be changed to sender in this library. This is due to the fact that from can't be a parameter in Python as it's a keyword, but the setting is correctly renamed after being passed as a JSON string when calling the API.
  • Read Invoice Generator API docs for complete understanding of the API and the parameters available. Not ALL paramaters have been tested with this API, so there can be some bugs!

How-to-use (By example)

The code is documented and there are no different endpoints with this API so there are no so many methods.

  1. Create the Invoice object
invoice = InvoiceGenerator(
    sender="Invoiced, Inc.",
    to="Parag",
    logo="https://invoiced.com/img/logo-invoice.png",
    number=1,
    notes="Thanks for your business!",
    shipping=50
)
  1. Add one or several items to it
invoice.add_item(
    name="Starter plan",
    quantity=1,
    unit_cost=99,
)
invoice.add_item(
    name="Fees",
    quantity=1,
    unit_cost=49,
)
  1. You can basically customise the object after hand (useful if you have to process things after generating the invoice but before actually sending it, perhaps for some async tasks...)
invoice.toggle_subtotal(shipping=True)
  1. Finally download the file (this will actually call the API). It can be absolute or relative path.
invoice.download("my-awesome-invoice.pdf")

python-invoice-generator's People

Contributors

aleaforny avatar nanthony21 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.