You can write your script so it works in both environments without changes. The trick is to check whether the context object is available:

from seatable_api import Base

try:
    from seatable_api import context
    base = Base(context.api_token, context.server_url)
except:
    base = Base('your-api-token', 'https://cloud.seatable.io')

base.auth()

A complete list of all pre-installed libraries can be found in the article Supported Python Libraries . There you will also learn how to add custom libraries on a self-hosted server.

The base.list_rows() method returns a maximum of 1,000 rows by default. To process more rows, use one of these approaches:

Option 1: Loop with offset

all_rows = []
offset = 0
while True:
    rows = base.list_rows(TABLE_NAME, start=offset, limit=1000)
    if not rows:
        break
    all_rows.extend(rows)
    offset += 1000

Option 2: SQL query

rows = base.query("SELECT * FROM `Table1` LIMIT 10000")

SQL queries support up to 10,000 rows per request.

Use json.dumps() with indentation to pretty-print dictionaries and lists:

import json
metadata = base.get_metadata()
print(json.dumps(metadata, indent=2))

For the complete function reference, visit the SeaTable Developer Manual .