accounting package

Submodules

accounting.client module

class accounting.client.Client(host=None, json_encoder=None, json_decoder=None)[source]

Bases: builtins.object

get(path)[source]
get_balance()[source]
get_register()[source]
post(path, payload, **kw)[source]
simple_transaction(from_acc, to_acc, amount, symbol=None, payee=None)[source]
accounting.client.main(argv=None, prog=None)[source]
accounting.client.print_balance_accounts(accounts, level=0)[source]
accounting.client.print_transactions(transactions)[source]

accounting.config module

accounting.decorators module

accounting.decorators.jsonify_exceptions(func)[source]

Wraps a Flask endpoint and catches any AccountingException-based exceptions which are returned to the client as JSON.

accounting.exceptions module

exception accounting.exceptions.AccountingException[source]

Bases: builtins.Exception

Used as a base for exceptions that are returned to the caller via the jsonify_exceptions decorator

accounting.gtkclient module

class accounting.gtkclient.AccountingApplication[source]

Bases: builtins.object

load_ui(path)[source]
on_about_dialog_response(widget, response_type)
on_show_about_activate(widget)[source]
on_transaction_refresh_activate(widget)
on_transaction_view_cursor_changed(widget)
on_transactions_loaded(transactions)[source]
accounting.gtkclient.indicate_activity(func_or_str)[source]
accounting.gtkclient.indicate_activity_done(func)[source]
accounting.gtkclient.main(argv=None)[source]

accounting.models module

class accounting.models.Account(name=None, amounts=None, accounts=None)[source]

Bases: builtins.object

class accounting.models.Amount(amount=None, symbol=None)[source]

Bases: builtins.object

class accounting.models.Posting(account=None, amount=None, metadata=None)[source]

Bases: builtins.object

class accounting.models.Transaction(id=None, date=None, payee=None, postings=None, metadata=None, _generate_id=False)[source]

Bases: builtins.object

generate_id()[source]

accounting.transport module

class accounting.transport.AccountingDecoder[source]

Bases: flask.json.JSONDecoder

dict_to_object(d)[source]
class accounting.transport.AccountingEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: flask.json.JSONEncoder

default(o)[source]

accounting.web module

This module contains the high-level webservice logic such as the Flask setup and the Flask endpoints.

accounting.web.index()[source]

Hello World!

accounting.web.init_ledger()[source]

flask.Flask.before_request()-decorated method that initializes an accounting.Ledger object.

accounting.web.main(argv=None)[source]
accounting.web.transaction_delete(transaction_id=None)
accounting.web.transaction_get()[source]

Returns the JSON-serialized output of accounting.Ledger.reg()

accounting.web.transaction_post()[source]

REST/JSON endpoint for transactions.

Current state:

Takes a POST request with a transactions JSON payload and writes it to the ledger file.

Requires the transactions payload to be __type__-annotated:

{
  "transactions": [
    {
      "__type__": "Transaction",
      "date": "2013-01-01",
      "payee": "Kindly T. Donor",
      "postings": [
        {
          "__type__": "Posting",
          "account": "Income:Foo:Donation",
          "amount": {
            "__type__": "Amount",
            "amount": "-100",
            "symbol": "$"
          }
        },
        {
          "__type__": "Posting",
          "account": "Assets:Checking",
          "amount": {
            "__type__": "Amount",
            "amount": "100",
            "symbol": "$"
          }
        }
      ]
    }
}

becomes:

2013-01-01 Kindly T. Donor
  Income:Foo:Donation                                         $ -100
  Assets:Checking                                              $ 100
accounting.web.transaction_update(transaction_id=None)

Module contents