Skip to main content

A client library for the FreshBooks API

Project description

Refreshbooks provides a simple synchronous API for manipulating FreshBooks

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'
)

response = c.invoice.create(
    invoice=dict(
        client_id='8',
        lines=[
            api.types.line(
                name='Yard Work',
                unit_cost='10',
                quantity='4'
            )
        ]
    )
)

invoice_response = c.invoice.get(
    invoice_id=response.invoice_id
)

print "New invoice created: #%s (id %s)" % (
    invoice_response.invoice.number,
    invoice_response.invoice.invoice_id
)

invoices_response = c.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'
)

# ... as above ...

API methods return lxml.objectify.ObjectifiedDataElement trees, which can be manipulated as Python objects with the same structure as the underlying XML.

References:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

refreshbooks-1.2.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

refreshbooks-1.2-py2.6.egg (13.5 kB view details)

Uploaded Egg

File details

Details for the file refreshbooks-1.2.tar.gz.

File metadata

  • Download URL: refreshbooks-1.2.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for refreshbooks-1.2.tar.gz
Algorithm Hash digest
SHA256 a9e105c2f4a153ec4e142cfb4acdd5e5caa9b605c6c15958cec233c43e9eda0b
MD5 989d0804b6268175b29673bb6972ef1b
BLAKE2b-256 24840e884b84f8b4abc557fc5e40b28b335667d5013c07dc4f99febf4958a305

See more details on using hashes here.

File details

Details for the file refreshbooks-1.2-py2.6.egg.

File metadata

  • Download URL: refreshbooks-1.2-py2.6.egg
  • Upload date:
  • Size: 13.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for refreshbooks-1.2-py2.6.egg
Algorithm Hash digest
SHA256 35eab602fe59158baa665cd346708c0703591ca5a6f999dedfe8117916243126
MD5 72dd901d5f18296997779544ae2b644b
BLAKE2b-256 c1d3d2a2ee5b6ee86e0cb3c85cbca1a666862716ddfb0b9236d995421cb23ea7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page