Python SDK
Overview
The generated Neurelo Python SDK provides easy access to your Neurelo APIs for Python applications.
Installation
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:

To install the necessary dependencies for this SDK, we will use the requirements.txt
as follows:
$ python3 -m pip install -r ./requirements.txt
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.
Usage
API Usage
Basic usage requires instantiating both a Configuration
and an ApiClient
class:
from neurelo.configuration import Configuration
from neurelo.api_client import ApiClient
configuration = Configuration(
host=NEURELO_API_HOST,
api_key={'ApiKey': NEURELO_API_KEY}
)
api_client = ApiClient(configuration=configuration)
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:
from neurelo.api.user_api import UserApi
user_api = UserApi(api_client)
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:
$ export NEURELO_API_KEY="<YOUR-API-KEY>"
$ export NEURELO_API_HOST="<HOST-NAME>"
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:
from neurelo import models
payload = models.UserCreateInput(
email=email,
fullname=fullname,
password=password,
)
user = user_api.create_one_user(payload)
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.
filtered = models.UserWhereInput.from_dict({"email": {"equals": template_email}})
users = user_api.find_user(filter=filtered)
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.
Example Applications
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 Projects built using Neurelo SDKs
Last updated