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.2.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.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: retoolrpc-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 52379a1b653fe5f0c8830dae823d898c4a637ea8111921635fea493153bbfbbd
MD5 ee3fbed86a3436c707ac52e41982130d
BLAKE2b-256 0ec89914aec479826386abc0325ea468bdefb7fd55c31278bfafe96acc8805e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retoolrpc-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c49506f2292e8513ee7b9525d46f120b1464eeee8cb0bc38ccc0fc7bc009407
MD5 968e634f13df06bcdc884f9ec5ae2ec7
BLAKE2b-256 bec8509438a6fe8d900b03d2441edfff7c5e0488f9c42b7624be42b99a17ed82

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