Skip to main content

Fakturownia

Python client library for the Fakturownia API

https://img.shields.io/pypi/v/fakturownia.svg https://img.shields.io/travis/wooyek/fakturownia-python.svg Documentation Status Coveralls.io coverage CodeCov coverage Maintainability License Tweet about this project https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg

If you don’t know it yet be sure to check it out:

Polecam Fakturownia.pl - prosty program do fakturowania online

Features

  • ☑ Invoice CRUD plus send_by_email and ‘mark_paid`

  • ☑ EU member states VAT rate helpers for B2C transactions

  • ☑ ApiClient CRUD

  • ☐ Payments CRUD

  • ☐ Products CRUD

  • ☐ Warehouse documents CRUD

  • ☐ Accounts management

Please refer to the fakturownia APIs for full API features

Quickstart

Install Fakturownia

pip install fakturownia python

Play with fakturownia APIs in python interpreter:

>>> import os
>>> os.environ.get('FAKTUROWNIA_API_TOKEN', 'Missing key')
'...'
>>> from fakturownia import get_api_client
>>> api = get_api_client()
>>> invoice = api.invoices.create(
...     seller_name='Kabaret Starszych Panów',
...     buyer_name='Odrażający drab',
...     positions=[{
...         'name': 'Smolna szczapa',
...         'quantity': 5,
...         'total_price_gross': 7.33,
...     }],
... )
>>> invoice.view_url
'...'

This instance is only partially updated as create returns only subset of data properties, to get all we need to update our instance.

If you have payments enabled you can call get to fetch all data and check payment_url:

>>> invoice.get()
<fakturownia.endpoints.Invoice object at 0x...>
>>> invoice.payment_url
'...'

We can mark this invoice as paid:

>>> invoice.mark_paid()
<fakturownia.endpoints.Invoice object at 0x...>

You can chain your calls:

>>> invoice.put(buyer_email='kominek@niepodam.pl').send_by_email()
<fakturownia.endpoints.Invoice object at 0x...>

You can play and test your scenarios wih factories:

pip install fakturownia[factories]
python

Now you can do this:

>>> from fakturownia.factories import InvoiceFactory
>>> InvoiceFactory(api_client='<your api key here>', kind='proforma').post().get().payment_url # doctest: +SKIP
'...'

Also checkout VAT tax normalization based on EU country specific VAT rates:

>>> InvoiceFactory(
...     api_client=api,
...     seller_country='PL',
...     buyer_country='DE',
...     buyer_tax_no=None,
... ).normalize_vat().post().view_url
'...'

Neat! :)

Running Tests

Does the code actually work?

pipenv install --dev
pipenv shell
tox

We recommend using pipenv but a legacy approach to creating virtualenv and installing requirements should also work. Please install requirements/base.txt and requirements/development.txt to setup virtual env for testing and development.

Help wanted

This library is not yet complete. It does what was needed by up to date contributors, but more can be done. You can implement new api endpoints and write test for them, it’s actually straightforward and new classes will be simple, but tests need some effort. We are lazy test writers and because we don’t want to compromise coverage so we postponed new apis until someone would want to write test.

If want to help please refer to the contributing section in the docs for more info.

Credits

This package was created with Cookiecutter and the wooyek/cookiecutter-pylib project template.

History

0.1.0 (2018-01-03)

  • First release on PyPI.

0.1.2 (2018-01-10)

  • endpoints indexing

  • Robust testing with mocked and real interchangeable backeds .

0.2.1 (2018-01-12)

  • EU member states VAT rate helpers for B2C transactions

  • FAKTUROWNIA_TIMEOUT setting for request timeout

0.2.2 (2018-01-18)

  • Payload data cleanup from readonly fields so get().put() is possible

Metadata

Release files for fakturownia 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fakturownia 0.2.2
File Size Uploaded
fakturownia-0.2.2.tar.gz 65.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fakturownia 0.2.2
File Interpreter ABI Platform
fakturownia-0.2.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 81.1 kB

Release files / fakturownia-0.2.2.tar.gz

Download URL fakturownia-0.2.2.tar.gz
Size 65.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8c6c81c79215b26ff909daf5ed756dbc6045ffde176c1dd2354bffc623ed04d8
BLAKE2b-256 checksum
How to use checksums
87582973f63edd40ea56704928c9533bcf4d6c142ae898f4a833c4e0c1532ecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / fakturownia-0.2.2-py2.py3-none-any.whl

Download URL fakturownia-0.2.2-py2.py3-none-any.whl
Size 16.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7e027f03e2be163dca7954e737ddc48c03cb3968243e043e131c92872b6568d3
BLAKE2b-256 checksum
How to use checksums
b6352ece24f5a9d2c053ec08e5499c2f73960891fd695aa1b8b3f52c96e93ca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page