Skip to main content

NERIS API Client

A Python class to interact with the NERIS API programmatically.

NOTE: Due to the changes and transition to using Oauth 2.0 version 1.2 is now deprecated. Please upgrade to version 1.3. You can do that in a package manager with the following update: neris-api-client = ">=1.3" or in your requirements.txt you can do neris-api-client >=1.3. Or you can install with pip install neris_api_client>=1.3..

Versioning

This API client does not directly follow semver practices. In order to remove confusion between the NERIS API client and API, we have decided to align the major version of this client with the major version of the API release. The minor and patch versions of this client will differ from API release version, they will instead represent changes made to the API client itself.

Installation

Requires Python 3.10 or later.

To install:

pip install neris-api-client

Package published on PyPi: NERIS API Client

Model generation

Install the locked development dependencies with pipenv sync --dev. The generation script downloads the live OpenAPI specification and overwrites models.py, then formats it with Black. From a Bash shell, run pipenv run bash gen.

Schema downloads explicitly use the generator's HTTPX2 backend, which datamodel-code-generator 0.76.2 labels experimental. HTTPX2 is pinned to 2.14.0 to retain Python 3.10 support; HTTPX2 2.15 and later require Python 3.11. For manual pipenv run datamodel-codegen commands, include --http-backend httpx2 so an installed copy of HTTPX does not take precedence. This development dependency does not change the client's Requests-based HTTP transport.

Usage

Auth with password auth flow

All config parameters can be specified as environment variables prefixed with NERIS_ e.g. NERIS_GRANT_TYPE=password.

from neris_api_client import NerisApiClient, Config

client = NerisApiClient(
    Config(
        base_url="https://api-test.neris.fsri.org/v1",
        grant_type="password",
        username="neris.user@email.co",
        password="*******",
        # Supply a custom user agent header value
        user_agent="MyApp/1.0",
    )
)

# Get an entity
entity = client.get_entity("FD24027240")

# If MFA enabled, prompt for auth challenge answer
Provide MFA code for email_otp: ******

Auth with client_credentials auth flow

All config parameters can be specified as environment variables prefixed with NERIS_ e.g. NERIS_GRANT_TYPE=client_credentials.

from neris_api_client import NerisApiClient, Config

client = NerisApiClient(
    Config(
        base_url="https://api-test.neris.fsri.org/v1",
        grant_type="client_credentials",
        client_id="********************",
        client_secret="***************",
        # Supply a custom user agent header value
        user_agent="FireFirst/1.0",
    )
)

# Get an entity
entity = client.get_entity("FD24027240")

Using environment varables to instantiate the library

Configuration should be stored in the environment. The following uses dotenv to load the configuration, but you can use whatever you like. In the cloud, you might load all of these values into the environment from an encrypted parameter store.

All variables prefixed are prefixed with NERIS_

  • See env.example for the parameter options.
  • Store the /env file in the current working directory.
from dotenv import load_dotenv
from neris_api_client import NerisApiClient, Config

 # Credentials must be defined in .env
load_dotenv()
client = NerisApiClient()

# Get an entity
entity = client.get_entity("FD24027240")

Additional config parameters

debug

Controls whether the application outputs debug information.

validate

Controls whether the client performs model validations.

ssl_verify

Controls TLS certificate verification. True/unset verifies with the default certifi bundle, False disables verification (not recommended), or pass a path to a custom CA bundle.

⚠️ Warning: Setting ssl_verify=False disables all TLS certificate verification, including protection against man-in-the-middle attacks. Credentials, tokens, and incident data would be sent over a connection that cannot confirm it's actually talking to the NERIS API. Only use this as a last resort for local debugging, never in production, and prefer supplying a custom CA bundle path instead.

Troubleshooting SSLCertVerificationError / unable to get local issuer certificate

If you see SSLCertVerificationError: unable to get local issuer certificate, your network traffic is likely passing through a TLS-inspecting proxy or firewall (common in corporate networks and hosted notebook environments such as ArcGIS Online Notebooks) that re-signs traffic with its own root certificate, which isn't trusted by Python's default certificate bundle. To resolve this, obtain the proxy/organization's root CA certificate (as a .pem file) from your network/IT administrator and point the client at it:

client = NerisApiClient(
    Config(
        ...,
        ssl_verify="/path/to/corporate-ca-bundle.pem",
    )
)

Or set the NERIS_SSL_VERIFY environment variable to the path of the CA bundle. If you don't have access to the CA bundle, confirm with your network administrator that outbound HTTPS access to api.neris.fsri.org is allowed.

Disclaimer

The models in this package are generated using datamodel-code-generator and are not guaranteed to contain all of the information present in the full specification. The generated models are used to validate request payloads prior to API submission.

Additional Information

To ask a question, make a suggestion, or otherwise get help with the NERIS API Client, please visit the NERIS helpdesk.

Beta sandbox users:

  • Be sure to use the base URL https://api-test.neris.fsri.org/v1 with the NERIS API Client. You will not be able to authenticate requests in the other environments.
  • For the beta testing period, your user is only authorized to perform actions on behalf of the FSRI Fire Department FD24027214.

Metadata

Release files for neris-api-client 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neris-api-client 1.6.0
File Size Uploaded Provenance Actions
neris_api_client-1.6.0.tar.gz 102.2 kB Without provenance Details for neris_api_client-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neris-api-client 1.6.0
File Interpreter ABI Platform Actions
neris_api_client-1.6.0-py3-none-any.whl Python 3 none any Details for neris_api_client-1.6.0-py3-none-any.whl

Total release size: 202.6 kB

Release files / neris_api_client-1.6.0.tar.gz

Download URL neris_api_client-1.6.0.tar.gz
Size 102.2 kB
Tags Source
SHA-256 checksum
How to use checksums
107b598e870654f91a292b1b6d8e9ceeb444de6125b6060cbb685033c69cad30
BLAKE2b-256 checksum
How to use checksums
cfa865eafd647b7602acd96462fd289288f51003c4e4c866ec7fa22c70aefd01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / neris_api_client-1.6.0-py3-none-any.whl

Download URL neris_api_client-1.6.0-py3-none-any.whl
Size 100.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9199ee5b7914080334289c55dfa1d6036b1fc92dd41f166e427e027bc272242
BLAKE2b-256 checksum
How to use checksums
e6c874e44a12e4ac8157e7772d18ba6bf82e228ecae87714735617d3203602b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for neris-api-client 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page