Python wrapper for Coda.io API
Project description
Python wrapper for Coda.io API
Installation
pip install codaio
Config via environment variables
The following variables will be called from environment where applicable:
CODA_API_ENDPOINT
(default valuehttps://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.all_tables()
[Table(name='Table1'), Table(name='table2')]
>>> doc.get_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)
Documentation
codaio
documentation lives at readthedocs.io
Using raw API
codaio
implements all methods of raw api in a convenient python manner. So API's listDocs
becomes in codaio
Coda.list_docs()
. Get requests return a dictionary. Put, delete and post return a requests Response object.
All methods of Coda class are describe in the documentation.
Project details
Release history Release notifications | RSS feed
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.3.0.tar.gz
(8.3 kB
view hashes)
Built Distribution
codaio-0.3.0-py3-none-any.whl
(8.2 kB
view hashes)