Skip to main content

Python wrapper for Coda.io API

Project description

Python wrapper for Coda.io API

Code style: black

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

Usage

You can initialize a document by providing API_KEY and document_id directly, or by storing yoru 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')

Methods

from codaio import Document

doc = Document.from_environment('YOUR_DOC_ID')

doc.tables() # list all tables
doc.get_table_rows(table_id_or_name='YOUR_TABLE')  # get ALL table rows
doc.get_table_rows(table_id_or_name='YOUR_TABLE', query={'query'})

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.1.2.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

codaio-0.1.2-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

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