Getting started (with Python)


Nextspace provides a Python library to interact with the Nextspace API.
The library is available on PyPi and can be installed using pip. Page link

The requirements for this library aren't fully completed yet, however, you are free to use what is available.

Setup

This library is developed for Python 3.6 and above. Use lower versions at your own risk.

To install, simply use the following command:

pip install bruce-models

Verify the installation by importing the library in your Python script.

import bruce_models as BM

You will be using two API instances for your communication with the Nextspace API. The Guardian API and the Bruce API.

The Guardian API is used for authentication and account management, while the Bruce API is your personal API for your account.

Here is how you create an instance of each API:

import bruce_models as BM

# Creating an instance of our Guardian API.
# By default, this communicates to our production login server.
guardian = BM.GuardianApi()

# Creating an instance of our Bruce API.
bruce = BM.BruceApi({
    "account_id": "your-account-id",
    "session_id": "session-if-already-known",
    # Pass in your instance so it doesn't generate its own.
    # This is optional and an optimization.
    "guardian": guardian
})

# Perform a test request to verify everything is correctly working.
test = bruce.GET("test")
print(test)