Skip to main content

community-tulip-api

This package wraps the Tulip API. This is not an official Tulip package.

If you are just getting started with the Tulip API I recommend reading this support article.

Authenticating

This package provides 3 methods of authenticating with Tulip.

  1. Environment Variable
  2. API Key & Secret
  3. base64 encoded auth string

Environment Variable

Set an environment variable TULIP_AUTH with base64 encoded {username}.{password} value of your bot user. After creating a bot this value can be found under Auth Header and will look like Basic {credential}.

export TULIP_AUTH=YXBpa2V5LjJfQzU5a0w4YWdMNndBSDZOM3Y6UmlsS1V3a3pIZ0ZPc19MUkczWFQ3djdaN0tZVEZpZVVscG1WTmR5QllLaQ==
from tulip_api import TulipAPI

api = TulipAPI("abc.tulip.co")

API Key & Secret

Pass in the API Key name and Secret to the TulipAPI class.

Example:

from tulip_api import TulipAPI

api = TulipAPI(
    "abc.tulip.co",
    api_key="apikey.2_C59kL8agL6wAH6N3v",
    api_key_secret="RilKUwkzHgFOs_LRG3XT7v7Z7KYTFieUlpmVNdyBYKi",
)

Base64 encoded auth string

Pass in the base64 encoded auth string. This would be the same value that the environment variables expects.

Example:

from tulip_api import TulipAPI

api = TulipAPI(
    "abc.tulip.co",
    auth="YXBpa2V5LjJfQzU5a0w4YWdMNndBSDZOM3Y6UmlsS1V3a3pIZ0ZPc19MUkczWFQ3djdaN0tZVEZpZVVscG1WTmR5QllLaQ=="
)

TulipTable Class

Table objects reflect the current state of a table.

Create Table Object

Pass the Table ID (from the table UI) and the TulipAPI object to create a TulipTable object.

Example:

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

TulipTable.create_record(data)

Create a record in a Tulip Table Object. The record data must be a json encoded dict with each key matching the unique field Ids in the TableUI. Not all fields in the table must be populated.

The create_random_id parameter is an optional attribute that will automatically set a record id if one hasn’t been given

Example:

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

record_data = {
    'id': '123456',
    'asfkha_field1': 12,
    'fhasif_field2': True
}
table.create_record(record_data)

TulipTable.update_record(record_id, data)

Update the record in a given table with a specific id. The record data must be a json encoded dict with each key matching the unique field Ids in the TableUI. Not all fields in the table must be populated.

Example:

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

record_data = {
    'asfkha_field1': 12,
    'fhasif_field2': True
}
table.update_record('123',record_data)

TulipTable.delete_record(record_id)

Update the record with the given record id.

Example:

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

table.delete_record('1234')

TulipTable.get_record(record_id)

Returns the json encoded data from a single record with the given record id.

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

rec_data = table.get_record("1234")

TulipTable.get_records()

Returns a list of records. This is limited to 100 records, but the offset parameter can be leveraged to loop through all of the records in a table.

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB


recs_data = table.get_records()

TulipTable.stream_records()

Stream table records from a Tulip Table. This will progressively return records in a table. All Table records will be returned as they are available. This is the most performative way to do anything with all of the records in a table.

from tulip_api import TulipAPI,TulipTable

api = TulipAPI("abc.tulip.co")
table = TulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

for record in table.stream_records():
    print(record)
    #DO SOMETHING

CachedTulipTable Class

Reflects a cached representation of a Tulip Table for more performative bulk data operations. The table is stored to memory.

Create Cached Tulip Table Object

from tulip_api import TulipAPI, CachedTulipTable


api = TulipAPI("abc.tulip.co")
table = CachedTulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

CachedTulipTable.update_data()

Forces the update of a cached Tulip Table

from tulip_api import TulipAPI,CachedTulipTable

api = TulipAPI("abc.tulip.co")
table = CachedTulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

table.update_data()

CachedTulipTable.get_record(record_id)

Returns the cached data from a Tulip Table with the associated record_id.

from tulip_api import TulipAPI,CachedTulipTable

api = TulipAPI("abc.tulip.co")
table = CachedTulipTable(api, 'bQLv6iMsau4ipqRiB')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

table.get_record("1234")

TulipTableLink Class

Represents the linked records between two Tulip Tables with the Linked Record type Table field.

The link id is the prefix for the field id in the table. For example, Table field crN9z6v6qXidrj8TX_link_right_column has the link id crN9z6v6qXidrj8TX

from tulip_api import TulipAPI,TulipTableLink

api = TulipAPI("abc.tulip.co")
link = TulipTableLink(api, 'crN9z6v6qXidrj8TX')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

Links the records in 2 tables based on the record IDs in each table. The left and right record definition is included in the table record field id’s (ex:crN9z6v6qXidrj8TX_link_right_column )

from tulip_api import TulipAPI,TulipTableLink

api = TulipAPI("abc.tulip.co")
link = TulipTableLink(api, 'crN9z6v6qXidrj8TX')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

link.link_records('1234','5678')

Unlinks the records in 2 tables based on the record IDs in each table. The left and right record definition is included in the table record field id’s (**ex:crN9z6v6qXidrj8TX_link_right_column )

from tulip_api import TulipAPI,TulipTableLink

api = TulipAPI("abc.tulip.co")
link = TulipTableLink(api, 'crN9z6v6qXidrj8TX')
# table url: https://abc.tulip.co/table/bQLv6iMsau4ipqRiB

link.unlink_records('1234','5678')

Metadata

Release files for community-tulip-api 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for community-tulip-api 0.1.9
File Size Uploaded
community-tulip-api-0.1.9.tar.gz 52.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for community-tulip-api 0.1.9
File Interpreter ABI Platform
community_tulip_api-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 94.8 kB

Release files / community-tulip-api-0.1.9.tar.gz

Download URL community-tulip-api-0.1.9.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56b96815c637a8b5ff835ae3398f2dcd2f20cf3ec3a01e3f56d742124472cf9d
BLAKE2b-256 checksum
How to use checksums
dcc1cb55bd528dcbcc068f8eebea41da8a6d9a5c902f4fb0cbc3e2ae77068f8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / community_tulip_api-0.1.9-py3-none-any.whl

Download URL community_tulip_api-0.1.9-py3-none-any.whl
Size 42.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f2dfd54b70c689281fb0c3ccd28d2599855dbc92d0533c5fa725fb38fa065e7
BLAKE2b-256 checksum
How to use checksums
f4f9dba5a5c654da221c6dc6116f6c2862891cd12aef9d10e5e2067f3a244048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page