Connections
Learn how to connect with third-party tools and services in your BDK project.
Last updated
Was this helpful?
Learn how to connect with third-party tools and services in your BDK project.
Last updated
Was this helpful?
Connections enable you to connect to third-party tools and services in your custom Book. To implement a connection, define a Python function in your Book class and decorate it with the decorator. This decorated function serves as the connection handler and defines the syntax for writing a .
Note: Implementing an OAuth connection in a custom BDK Book is not supported at this time.
You can define multiple connections within a Book, each with its own handler method. Use the noun_phrase
keyword argument in the decorator to assign a unique label to each connection and differentiate between authentication methods.
In your connection method docstring, include the following sections in addition to a brief summary:
Specify the Python function's parameters.
Define labels for the connection arguments (e.g., API key, credentials) that will be used in your . Labels correspond to parameters in your function's definition.
When a label is provided in the docstring, the lowercase form is used in a connection command. When not provided, the label will be inferred from the Python variable name.
Example
In this example, API Key
is the label for the api_key
connection argument. The lowercase version of the label is used in a connection command (api key
):
Additional Examples
api_key: ApI kEy
In this example, the connection command uses the lowercase form of ApI kEy
:
api_key: aPi_KeY
In this example, the connection command uses the lowercase version of aPi_KeY
:
No Label
If a label is not provided in the docstring, it is inferred from the Python variable name, api_key
: