Skip to main content

Coded statement of Account (CODA) python API

Project description

pycoda

CI status Coverage Status License: MIT PyPI version Code style

Quickstart

Generate a CODA file from a factory:

>>> from pycoda.factories import CodaFileFactory
>>> coda_file = CodaFileFactory()
>>> print coda_file.dumps()
0000029050288805        TWlscjlKSUAnthony Hicks             GKCCBEBB   06141120086                                             2
10000                                     0000000026785942011208                                                             000
2121170000                     0000000700448471091015000000000                                                     15030900000 0
8000                                     0000000000000000160417                                                                0
9               134803000000336605556000000724123462                                                                           2

Check the values of the first record:

>>> coda_file.records[0].field_dict()
{'account_holder_reference': 61411200863,
 'addressee': u'Anthony Hicks',
 'application_code': u'05',
 'bank_identification_number': 888,
 'bic': u'GKCCBEBB',
 'creation_date': datetime.date(2002, 5, 29),
 'duplicate': False,
 'empty': None,
 'free': None,
 'identification': 0,
 'reference': u'TWlscjlKSU',
 'related_reference': None,
 'transaction_reference': None,
 'version_code': 2,
 'zeroes': None}

Update a named field of the first record:

>>> coda_file.records[0].addressee = u'John Doe'
>>> print coda_file.records[0].dumps()
0000029050288805        TWlscjlKSUJohn Doe                  GKCCBEBB   06141120086                                             2

Make a new CODA file object and load the records / fields from the previous object string representation:

>>> plain = coda_file.dumps()
>>> from pycoda.codafile import CodaFile
>>> new_coda = CodaFile()
>>> new_coda.loads(plain)
>>> print new_coda.dumps()
0000029050288805        TWlscjlKSUJohn Doe                  GKCCBEBB   06141120086                                             2
10000                                     0000000026785942011208                                                             000
2121170000                     0000000700448471091015000000000                                                     15030900000 0
8000                                     0000000000000000160417                                                                0
9               134803000000336605556000000724123462                                                                           2
>>> new_coda.dumps() == coda_file.dumps()
True

Model

The following model hierarchy is employed:

  • CODA file: can consist of multiple records of given type
  • Record type: each of the record types hold different specified named fields of given type
  • Field type: the fields hold the actual values. All the parsing / printing footwork is done at this level

For each of those levels, the objects can:

  • loads: set value from string representation
  • dumps: generate string representation from value

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

codapy-0.3.18.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

codapy-0.3.18-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file codapy-0.3.18.tar.gz.

File metadata

  • Download URL: codapy-0.3.18.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for codapy-0.3.18.tar.gz
Algorithm Hash digest
SHA256 6ac18a6969d7ad03a5ab0d7624b6e68cb1949082f53b84f8917509cf5a90f79a
MD5 4637abf5be6dcbc186b6f554bfabf5b8
BLAKE2b-256 396bd54b7cea49b2a315144e5158194793e7c08cb5b334d141dac2eb48bcac7f

See more details on using hashes here.

File details

Details for the file codapy-0.3.18-py3-none-any.whl.

File metadata

  • Download URL: codapy-0.3.18-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for codapy-0.3.18-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b95301f6dde52a8ac14e12b7b539682d7aec5e733cb0e892194370ff2ad084
MD5 2a73d89415eb79347c62e2ecad971783
BLAKE2b-256 18616372e3bf44e0ad588d59e8bc611a6e5ac65fee63bb5d62c7fcfcfe85bbf5

See more details on using hashes here.

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