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

Uploaded Source

File details

Details for the file python-subledger-0.1.zip.

File metadata

  • Download URL: python-subledger-0.1.zip
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-subledger-0.1.zip
Algorithm Hash digest
SHA256 f81b491cf662b1b146eddaf2719d0a4b862fca68ead2430638452ebd693a4540
MD5 64eb4516698fafc4bb7774f6389c09af
BLAKE2b-256 41537adb907cd82d3e572a80f219a09f29baa60f21506d71a900c4067f638ea0

See more details on using hashes here.

Supported by

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