Python SDK
Last updated
Last updated
The generated Neurelo Python SDK provides easy access to your Neurelo APIs for Python applications.
Refer to this guide Python SDK Tutorial -- News Application for a detailed tutorial on downloading, installing, and using the Python SDKs with FastAPI.
Download the Custom Python SDK for your Project from the APIs page under the Neurelo environment that you want to interact with.
A gzip compressed tar archive (.tgz
) SDK file should be downloaded. First, uncompress this file to get the underlying folder. Doing so, you are likely to see a directory as follows:
The downloaded SDK file will be named - neurelo-sdk-python-cmt_xxxxxx.tgz
(where xxxxxx
are the last 6 digits of the definition commit applied to the environment)
To install the necessary dependencies for this SDK, we will use the requirements.txt
as follows:
If you have used Neurelo SDK’s in the past, to ensure that the older version of neurelo
package is uninstalled, do a python3 -m pip uninstall neurelo
and rerun your requirements.txt
command from above.
Basic usage requires instantiating both a Configuration
and an ApiClient
class:
Each object defined in your Neurelo data definition has a class that can be instantiated by passing the ApiClient
instance into the constructor of the object's class. For example, if your data definition contains a 'User' object, you can instantiate the User class by passing the ApiClient
instance into its constructor as shown below:
To obtain the NEURELO_API_HOST
, simply copy the host name mentioned in the Environments tab.
Additionally, you can generate a NEURELO_API_KEY
by creating a new API Key from the “API Keys” tab. You can export these values using a command similar to the following in our terminal:
When calling operations with body, the body is encapsulated within specific classes. To use it, create an instance of the respective class and use the parameter values, as shown below:
Similarly, when calling operations with parameters (for example, fetching all user info containing a email as XYZ
), the parameters are also encapsulated within specific classes. To use these parameters, we create an instance of the respective class and use it as the parameter value, as shown below.
It is important to use our models
submodule to create these parameters. The resulting parameter expression, like {"email": {"equals": template_email}}
, is standard with our REST API. More information on this can be found in our Neurelo API Reference (REST) guide.
Although you can directly make API calls with parameters using the object API class as follows: user_api.find_user(filter=<filter-condition>)
, we do not recommend this approach. Instead, use the models submodule to create the parameters.
Type hints are available for all parameters, for all operations to aid in understanding which class is should be used with each parameter.
The following applications are provided to demonstrate how to use Neurelo, and Neurelo’s generated Python SDK.
To review more examples of applications built using Neurelo's SDK, please visit