Skip to content

Common questions (Python)

How to make the script support both local and cloud run

How to make the script support both local and cloud run

Flexible authorization

When the script runs in the cloud, it will provide a context object, which contains the server URL auto generated by the system and the API token of base. If you run the script in local, you need to manually specify these two variables; the API token can be generated in the drop-down menu "Advanced -> API Token" of the table.

Use the following method to make the script support both local and cloud run

from seatable_api import Base, context

server_url = context.server_url or 'https://cloud.seatable.io'
api_token = context.api_token or 'c3c75dca2c369848455a39f4436147639cf02b2d'


base = Base(api_token, server_url)
base.auth()

Dependencies that need to be installed to run the script local

The script need to install seatable-api when run in local.

pip3 install seatable-api

Additional requirements are:

  • Python >= 3.5
  • requests
  • socketIO-client-nexus
List of libraries supported in the cloud environment

List of libraries supported in the cloud environment

In the cloud environment, Python scripts run within a Docker container. This container comes pre-configured with a set of Python libraries that can be imported and used in your scripts. If you require libraries not included in this set, please contact our support team. Otherwise, scripts using unsupported libraries can only be executed locally.

Python Standard Library

The cloud environment currently utilizes Python 3.11. This version supports all modules in the Python 3.11 standard library. Common built-in libraries such as os, sys, datetime, and others are readily available for use in your scripts.

Third-Party Libraries

In addition to the standard library, we've included several popular third-party packages to enhance your scripting capabilities:

  • seatable-api: Official SeaTable Python API
  • dateutils: Extensions to Python's datetime module
  • requests: HTTP library for Python
  • pyOpenSSL: Python wrapper for OpenSSL
  • Pillow: Python Imaging Library (Fork) with support for HEIF images
  • python-barcode: Barcode generator
  • qrcode: QR Code generator
  • pandas: Data manipulation and analysis library
  • numpy: Fundamental package for scientific computing
  • openai: OpenAI API client library
  • ldap3: LDAP v3 client library
  • pydantic: Data validation and settings management using Python type annotations
  • httpx: A next-generation HTTP client for Python
  • PyJWT: JSON Web Token implementation in Python
  • python-socketio: Python implementation of the Socket.IO realtime server
  • scipy: Fundamental algorithms for scientific computing in Python
  • PyPDF: PDF toolkit for Python
  • pdfmerge: Merge PDF files

This list is not exhaustive. For a complete, up-to-date list of available third-party packages, you can run the following Python script in your SeaTable environment:

import pkg_resources

installed_packages = pkg_resources.working_set
packages_list = sorted([f"{i.key}=={i.version}" for i in installed_packages])

for package in packages_list:
    print(package)
Install and use custom python libraries

Install and use custom python libraries

  • The python libraries in SeaTable Cloud can not be changed.
  • If you run your own SeaTable Server it is possible to install your own libaries.