invoices, clients, and other data::
from refreshbooks import api
c = api.OAuthClient(
'example.freshbooks.com',
'consumerkey',
'My Consumer Secret',
'An existing token',
'An existing token secret',
user_agent='Example/1.0'
)
# XML structure inferred from args
response = c.invoice.create( # <request method="invoice.create">
invoice=dict( # <invoice>
client_id='8', # <client_id>8</client_id>
lines=[ # <lines>
api.types.line( # <line>
name='Yard Work', # <name>Yard Work</name>
unit_cost='10', # <unit_cost>10</unit_cost>
quantity='4' # <quantity>4</quantity>
) # </line>
] # </lines>
) # </invoice>
) # </request>
invoice_response = c.invoice.get( # <request method="invoice.get">
invoice_id=response.invoice_id # <invoice_id>...</invoice_id>
) # </request>
print "New invoice created: #%s (id %s)" % (
invoice_response.invoice.number,
invoice_response.invoice.invoice_id
)
invoices_response = c.invoice.list() # <request method="invoice.list" />
print "There are %s pages of invoices." % (
invoices_response.invoices.attrib['pages'],
)
for invoice in invoices_response.invoices.invoice:
print "Invoice %s total: %s" % (
invoice.invoice_id,
invoice.amount
)
Consumer keys and secrets can be obtained from FreshBooks. This library
does not handle negotiating for an OAuth token+secret pair; see the
`oauth` module or the OAuth specification for details.
This library also supports the older token-based API authorization
scheme::
c = api.TokenClient(
'example.freshbooks.com',
'My API token',
user_agent='Example/1.0'
)
# ... as above ...
API methods return lxml.objectify.ObjectifiedDataElement trees, which
can be manipulated as Python objects with the same structure as the
underlying XML.
If you are having trouble accessing items as in:
items_response = c.items.list()
for item in items_response.items.item:
print item.item_id
Adjust your syntax to use dictionary item lookup:
items_response = c.items.list()
for item in items_response['items'].item:
print item.item_id
ObjectifiedDataElement provides a method named items which shadows the
items element in the response. Accessing items with dictionary lookup
syntax is the known work-around.
To run tests:
python setup.py nosetests
To run network-accessing integration tests against httpstat.us:
python setup.py nosetests --attr=integration
References:
- http://developers.freshbooks.com/ - The FreshBooks API
- http://developers.freshbooks.com/authentication-2/#OAuth - FreshBooks and OAuth
Metadata
Release files for refreshbooks 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| refreshbooks-2.0.tar.gz | 14.2 kB | Without provenance | Details for refreshbooks-2.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| refreshbooks-2.0-py3.2.egg | Legacy Egg format | - | - | Details for refreshbooks-2.0-py3.2.egg |
| refreshbooks-2.0-py2.7.egg | Legacy Egg format | - | - | Details for refreshbooks-2.0-py2.7.egg |
Total release size: 58.1 kB
Release files / refreshbooks-2.0.tar.gz
| Download URL | refreshbooks-2.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17be66415e656e76ae3596de482ad6ceb949a074995335e05283a2f49d445b3f
|
|
BLAKE2b-256 checksum How to use checksums |
ea2dbf57186bc4e0e6fc99c7744516e03b2864b546484f0d4b067a0d8e7d064a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / refreshbooks-2.0-py3.2.egg
| Download URL | refreshbooks-2.0-py3.2.egg |
|---|---|
| Size | 22.3 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
bd9742e1a494e34314645a457221835b7385861e4d7a27382451d51e1d8c2067
|
|
BLAKE2b-256 checksum How to use checksums |
93399335e4bf6fcb9c2217679d7d63664a824a6b75c660b98b52363e5c277f7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / refreshbooks-2.0-py2.7.egg
| Download URL | refreshbooks-2.0-py2.7.egg |
|---|---|
| Size | 21.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
2936520b15fe79ad6c69ee3ec3daff6039f5a5ae40c6b0704c3b5a97b3cea951
|
|
BLAKE2b-256 checksum How to use checksums |
17b0f2b2e94d4b2417f6d8d97884c9eba765b07039cfff44e1a1f1f5387a2555
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for refreshbooks 2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.