Skip to main content

Python package for Retool RPC

Project description

retoolrpc Python client package

Review Retool's RPC documentation before installing the JavaScript package.

Installation

Use pip or poetry to install the packages.

# Using pip
pip install retoolrpc asyncio

# Using poetry
poetry init
poetry add retoolrpc asyncio

Usage example

import asyncio
from retoolrpc import RetoolRPC, RetoolRPCConfig

async def start_rpc():
  rpc_config = RetoolRPCConfig(
      api_token="your-api-token-here", # Replace this token with your API token
      host="http://localhost:3000/", # Replace this host with your host domain
      resource_id="resource-id", # Replace this resource ID with your ID
      environment_name="production", # Replace this environment name with your name (defaults to production)
      polling_interval_ms=1000, # The polling interval for the RPC
      version="0.0.1", # An optional version number for functions schemas
      log_level="info", # Change to 'debug' for verbose logging
  )

  rpc = RetoolRPC(rpc_config)

  def helloWorld(args, context):
      return f"Hello {args['name']}!"

  rpc.register(
      {
          "name": "helloWorld",
          "arguments": {
              "name": {
                  "type": "string",
                  "description": "Your name",
                  "required": True,
                  "array": False,
              },
          },
          "implementation": helloWorld,
          "permissions": None,
      }
  )

  await rpc.listen()

if __name__ == "__main__":
  asyncio.run(start_rpc())

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

retoolrpc-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

retoolrpc-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file retoolrpc-0.1.1.tar.gz.

File metadata

  • Download URL: retoolrpc-0.1.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.13 Darwin/21.6.0

File hashes

Hashes for retoolrpc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 684b6bc001e839c4bc0c32d4ba6db0d23dea48bda7ada5869c68b4ae07029f9f
MD5 d05804473e03bda831f93eeb0ae1e0b3
BLAKE2b-256 e8b346770f2d5c9db53f266870f1a5424b8f589c12dba2dde112b97b33a1dac1

See more details on using hashes here.

File details

Details for the file retoolrpc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: retoolrpc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.13 Darwin/21.6.0

File hashes

Hashes for retoolrpc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3f79b8734fa6aa1de266d10e11c5aedc4c93ee1483fc956bffbfbfb5aec66c
MD5 d7687bd06f7423a243117d6044eab51f
BLAKE2b-256 1801a587992afacbb3213a0aaee184a973aed6810e6a6c886557c629b8d90013

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page