The Python interface to online accounting service [Fakturoid](http://fakturoid.cz/).
Project description
fakturoid.cz Python API
The Python interface to online accounting service Fakturoid using Faktiuroid's v3 api.
This library is developed and maintained by Jaroslav Henner (jaroslav.henner@gmail.com). It is unoficial and no support from Fakturoid team can be claimed.
Installation
Install from PyPI
pip install fakturoid-v3
or alternatively install development version directly from github
pip install -e git+git://github.com/jarovo/python-fakturoid-v3#egg=fakturoid-v3
Supported Python versions are 2.6+ and 3.x. Dependencies are requests, python-dateutil
Quickstart
Generate the Client ID and Client Secret from your Fakturoid user screen: Settings → User account.
Create context:
from fakturoid import Fakturoid
fa = Fakturoid('yourslug', 'CLIENT_ID', 'CLIENT_SECRET', 'YourApp')
fa.oauth_token_client_credentials_flow()
Print 25 regular invoices in year 2013:
from datetime import date
for invoice in fa.invoices(proforma=False, since=date(2013,1,1))[:25]:
print(invoice.number, invoice.total)
Delete subject with id 27:
subject = fa.subject(27)
fa.delete(subject)
And finally create new invoice:
from fakturoid import Invoice, InvoiceLine
invoice = Invoice(
subject_id=28,
number='2013-0108',
due=10,
issued_on=date(2012, 3, 30),
taxable_fulfillment_due=date(2012, 3, 30),
lines=[
# use Decimal or string for floating values
InvoiceLine(name='Hard work', unit_name='h', unit_price=40000, vat_rate=20),
InvoiceLine(name='Soft material', quantity=12, unit_name='ks', unit_price="4.60", vat_rate=20),
]
)
fa.save(invoice)
print(invoice.due_on)
API
Fakturoid.account()
Returns Account instance. Account is readonly and can't be updated by API.
Fakturoid.subject(id)
Returns Subject instance.
Fakturoid.subjects(since=None, updated_since=None, custom_id=None)
Loads all subjects filtered by args.
If since (date or datetime) parameter is passed, returns only subjects created since given date.
Fakturoid.subjects.search("General Motors")
Perform full text search on subjects
Fakturoid.invoce(id)
Returns Invoice instance.
Fakturoid.invoices(proforma=None, subject_id=None, since=None, updated_since=None, number=None, status=None, custom_id=None)
Use proforma=False/True parameter to load regular or proforma invoices only.
Returns list of invoices. Invoices are lazily loaded according to slicing.
fa.invoices(status='paid')[:100] # loads 100 paid invoices
fa.invoices()[-1] # loads first issued invoice (invoices are ordered from latest to first)
Fakturoid.fire_invoice_event(id, event, **args)
Fires basic events on invoice. All events are described in Fakturoid API docs.
Pay event can accept optional arguments paid_at and paid_amount
fa.fire_invoice_event(11331402, 'pay', paid_at=date(2018, 11, 17), paid_amount=2000)
Fakturoid.generator(id)
Returns Generator instance.
Fakturoid.generators(recurring=None, subject_id=None, since=None)
Use recurring=False/True parameter to load recurring or simple templates only.
Fakturoid.save(model)
Create or modify Subject, Invoice or Generator.
To modify or delete invoice lines simply edit lines
invoice = fa.invoices(number='2014-0002')[0]
invoice.lines[0].unit_price = 5000 # edit first item
del invoice.lines[-1] # delete last item
fa.save(invoice)
Fakturoid.delete(model)
Delete Subject, Invoice or Generator.
subj = fa.subject(1234)
fa.delete(subj) # delete subject
fa.delete(Subject(id=1234)) # or alternativelly delete is possible without object loading
Models
All models fields are named same as Fakturoid API.
Values are mapped to corresponding int, decimal.Decimal, datetime.date and datetime.datetime types.
Fakturoid.Account
https://fakturoid.docs.apiary.io/#reference/account
Fakturoid.Subject
https://fakturoid.docs.apiary.io/#reference/subjects
Fakturoid.Invoice
Fakturoid.InvoiceLine
https://fakturoid.docs.apiary.io/#reference/invoices
Fakturoid.Generator
https://fakturoid.docs.apiary.io/#reference/generators
Use InvoiceLine for generator lines
Fakturoid.Message
http://fakturoid.docs.apiary.io/#reference/messages
Fakturoid.InventoryItems
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fakturoid_v3-0.1.0.tar.gz.
File metadata
- Download URL: fakturoid_v3-0.1.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7f95c3700b4a1332732271e318c45dcf16b02714ba3c4b773f1902b9041b2e
|
|
| MD5 |
cf6052d9327ba5ba5f25bcb098632383
|
|
| BLAKE2b-256 |
a260f2b6e9c11a3fd963fb3773276f4bc02182d65723b7086bb1a32fa0e95bf0
|
Provenance
The following attestation bundles were made for fakturoid_v3-0.1.0.tar.gz:
Publisher:
python-publish.yml on jarovo/python-fakturoid-v3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fakturoid_v3-0.1.0.tar.gz -
Subject digest:
fc7f95c3700b4a1332732271e318c45dcf16b02714ba3c4b773f1902b9041b2e - Sigstore transparency entry: 204631797
- Sigstore integration time:
-
Permalink:
jarovo/python-fakturoid-v3@43121736d131c9ccbd00f3346f2575eff045ce47 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/jarovo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@43121736d131c9ccbd00f3346f2575eff045ce47 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fakturoid_v3-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fakturoid_v3-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1157e6bacf1dda1d48e9b1602063097b7b05f533a2f0468febde5b639e781009
|
|
| MD5 |
a195bbda1daab919e755eb62f9f8a846
|
|
| BLAKE2b-256 |
b2cf2c14b8f1d828b8bb5c592c462b13e438a637cc81a02b15689132007a38c4
|
Provenance
The following attestation bundles were made for fakturoid_v3-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on jarovo/python-fakturoid-v3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fakturoid_v3-0.1.0-py3-none-any.whl -
Subject digest:
1157e6bacf1dda1d48e9b1602063097b7b05f533a2f0468febde5b639e781009 - Sigstore transparency entry: 204631801
- Sigstore integration time:
-
Permalink:
jarovo/python-fakturoid-v3@43121736d131c9ccbd00f3346f2575eff045ce47 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/jarovo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@43121736d131c9ccbd00f3346f2575eff045ce47 -
Trigger Event:
release
-
Statement type: