Skip to main content

Python client for the Subledger in-app accounting service.

Project description

python-subledger
================

Python implementation of the Subledger.com API for double entry accounting

Documentation and API endpoint: https://api.subledger.com/

### Beware ###
This library is experimental and unfinished. Do not rely on it (yet).

Feel free to suggest code changes or features!

The base for working with Subledger is an Organization. You can get yourself an
identity (user) with Subledger. With this identity and an API key, you can
create an Organization. The Organization will house accounting Books and journal
entries.

Implemented:
* Organization
* Book
* Account
* JournalEntry

Todo:
* Switch to v2: https://api.subledger.com/v2/
* Fix broken tests
* Implement Category
* Implement Report

Nice to hace:
* Implement Identity
* ReportRenderings

## Usage ##

from subledger import Book, Organization

# Authenticate with your Subledger credentials
Book.authenticate(api_key, api_secret)

# Use your organization to browse the books and accounts
org = Organization.from_id('<your org ID>')
for book in Book.all(org):
print book

# Create a new book and archive it immediately
book = Book(org, 'USD')
book.save()
print len(list(Book.all(org))), 'active books'
print len(list(Book.all(org, state='archived'))), 'archived books'

book.archive()
print len(list(Book.all(org))), 'active books'
print len(list(Book.all(org, state='archived'))), 'archived books'


## Class pattern ##

### SubledgerBase ###
All models derive from SubledgerBase
#### .authenticate(key_id, secret)
Register your API key credentials to get access to the Subledger API.

#### .from_id(id_)
Create the instance by loading the data from Subledger.

#### .from_dict(dict)
Create the instance from the given dict without requests to Subledger.

#### .save()
Write the values to Subledger.

It will not save data recursively. For example;
book.save()
will **not** save changes made to book.organization

### Organization ###
#### .from_id(org_id)

### Book ###
#### .from_id(book_id, org_id)
#### .organization
The Organization object this Book belongs to.

### Account ###
#### .from_id(account_id, org_id, book_id)
#### .book
The Book object this Account belongs to.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

python-subledger-0.1.zip (8.3 kB view hashes)

Uploaded Source

Supported by

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