An Abstract Tool to Perform Actions on Integrations
Project description
Lumos Connectors
Table of Contents
Installation
pip install connector
Usage
The package can be used in three ways:
- A CLI to scaffold a custom connector with its own CLI to call commands
- A library to create a custom connector
- A library to convert your custom connector code to a FastAPI HTTP server
To get started, run connector --help
An example of running a command that accepts arguments
in an integration connector called mock-connector
:
mock-connector info --json '{"a": 1}'
Scaffold
To scaffold a custom connector, run connector scaffold --help
To scaffold the mock-connector, run
connector scaffold mock-connector "projects/connectors/python/mock-connector"
Unasync
When developing this package, start off creating async functions and then
convert them to sync functions using unasync
.
connector hacking unasync
FastAPI
To convert your custom connector to a FastAPI HTTP server, run connector hacking http-server
Tips
The library I want to use is synchronous only
You can use a package called asgiref
. This package converts I/O bound synchronous
calls into asyncio non-blocking calls. First, add asgiref to your dependencies list
in pyproject.toml
. Then, in your async code, use asgiref.sync_to_async
to convert
synchronous calls to asynchronous calls.
from asgiref.sync import sync_to_async
import requests
async def async_get_data():
response = await sync_to_async(requests.get)("url")
License
connector
is distributed under the terms of the Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for connector_py-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f607f3082344724acd037f9d614a3107c9fe6dd1cb1c76bc7a3d27f3b45c0c99 |
|
MD5 | 4d1d874ffa87e5a8256d36174c755bfc |
|
BLAKE2b-256 | 8fedab93af37464e51cfd4017429fb54c5c2da0b3d07c7ae7ecdbc5eda761014 |