Thin Python 3 client for the InvoiceXpress REST API
Project description
Thin Python 3 client for the InvoiceXpress REST API.
API docs at: https://developers.invoicexpress.com/docs/versions/2.0.0/
Sample usage
import invoicexpress_api as ie
BASE_URL = 'https://mycompany.app.invoicexpress.com'
API_KEY = 'my api key'
invoice_data = {
"invoice": {
"date": "17/04/2018",
"due_date": "17/04/2018",
"client": {
"name": "John Doe",
"code": "XYZ123"
},
"items": [
{
"name": "SRV1",
"description": "Service 1",
"unit_price": 10.0,
"quantity": 5.0,
"tax": {
"name": "IVA23"
}
}
]
}
}
c = ie.Client(BASE_URL, API_KEY)
inv_type = ie.invoices.Types.INVOICE_RECEIPT
inv = ie.invoices.create(c, invoice_data, inv_type)
print('## Create invoice result')
print(inv)
cli = ie.clients.code_search(c, inv[inv_type]['client']['code'])
cli_upd = {"client": {"fiscal_id": "212345678", "country": "Portugal"}}
ie.clients.update(c, cli['client']['id'], cli_upd)
print('## Client Updated')
print(cli)
inv[inv_type]['items'][0]['unit_price'] = 150
ie.invoices.update(c, inv[inv_type]['id'], inv, inv_type)
print('## Invoice Updated')
print(inv)
ie.invoices.change_state(c, inv[inv_type]['id'], ie.Invoices.States.FINAL)
inv = ie.invoices.get(c, inv[inv_type]['id'])
print('## Invoice Settled')
print(inv)
print('PDF URL: ', ie.invoices.get_pdf_url(c, inv[inv_type]['id']))
ie.invoices.send_email(c, inv[inv_type]['id'], 'email@domail.tld', 'New invoice!', 'Hi John,\r\nHere is your new invoice\r\nRegards,')
print('## E-mail sent')
License
MIT
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
Close
Hashes for invoicexpress_api-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3578e814f080b0bf010ec7ad050ecf411ed7451bd9624e1e8a010d80cd799cea |
|
MD5 | 972be30f86bde04c4a010a0805f5e5d1 |
|
BLAKE2b-256 | 60644d2418e4c2c778f521ceac4d73a61890863d1a5c5eb316303592e4abd5fa |