Skip to main content

Python wrapper for Coda.io API

Project description

Python wrapper for Coda.io API

PyPI - Python Version CodaAPI Code style: black PyPI

Installation

pip install codaio

Config via environment variables

The following variables will be called from environment where applicable:

  • CODA_API_ENDPOINT (default value https://coda.io/apis/v1beta1)
  • CODA_API_KEY - your API key to use when initializing document from environment

Quickstart

You can initialize a document by providing API_KEY and document_id directly, or by storing your API key in environment under CODA_API_KEY

from codaio import Document

# Directly
doc = Document('YOUR_DOC_ID', 'YOUR_API_KEY')

# From environment
>>> doc = Document.from_environment('YOUR_DOC_ID')
>>> print(doc)
Document(id='YOUR_DOC_ID', name='Document Name', owner='owner@example.com', browser_link='https://coda.io/d/URL')

>>> doc.tables()
[Table(name='Table1'), Table(name='table2')]

>>> doc.find_table('Table1')
Table(name='Table1')

>>> table.columns
[Column(name='First Column', calculated=False)]

>>> table.rows
[Row(name='Some row', index=1)]

# Find row by column name and value:
>> table.find_row_by_column_name_and_value('COLUMN_NAME', 'VALUE')
Row(name='Some row', index=1)

# Find row by column id and value
>>> table.find_row_by_column_id_and_value('COLUMN_ID', 'VALUE')
Row(name='Some row', index=1)

# To get cell value for a column use getitem:
>>> row['Column 1']
Cell(column=Column 1, row=Some row, value=Some Value)

Using raw API

You can issue raw API requests directly using Document methods get and post. You can skip entire url up to /docs/{docId}, this is handled by the wrapper. So for request to https://coda.io/apis/v1beta1/docs/{docId}/tables just use endpoint value of /tables:

from codaio import Document

doc = Document.from_environment('YOUR_DOC_ID')

tables = doc.get(endpoint='/tables')

You can also use offset and limit to get a portion of results. If limit is not set, all the data will be automatically fetched. Pagination is handled for you by the wrapper.

Contributing

All contributions, issues and PRs very welcome!

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

codaio-0.2.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codaio-0.2.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file codaio-0.2.3.tar.gz.

File metadata

  • Download URL: codaio-0.2.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Windows/10

File hashes

Hashes for codaio-0.2.3.tar.gz
Algorithm Hash digest
SHA256 5c2befdbdafd3c8d997650edd0cd9f6787a066954af57aa5bf94f038e027a949
MD5 dba7789747215f275c6588a6388e08cc
BLAKE2b-256 07da1d0315a8be9083e77236c76887300228b98d1575626d1f84ebb8b7e8abf9

See more details on using hashes here.

File details

Details for the file codaio-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: codaio-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Windows/10

File hashes

Hashes for codaio-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3971ff9632091424a067f8bbe252abc779925139541a4ed25e1879a38673c1c3
MD5 07f75d6b2b5479cddbaaf07cc6cecbe5
BLAKE2b-256 3ab8a22f9a2af6c210c2615b7448c27a17a54985ee288136b31cc29183ba71dd

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