# Python API Example

**Example**: The following example show on how to read retrieve data where equipment type is 'CHASIS'

## Step 1: Import required library (CaaSClient) <a href="#step-1-import-required-library-caasclient" id="step-1-import-required-library-caasclient"></a>

```
from cfxdx.dataapi import CaaSClient
```

## Step 2: Credentials to connect to the system. <a href="#step-2-credentials-to-connect-to-the-system" id="step-2-credentials-to-connect-to-the-system"></a>

Use API keys to connect to the system

```
credentials = {   "login-method": "access-key",   "host": "hostname or ipaddress",   "access-key": "value for API-access-key",   "secret-key": "value for API-secret-key"}
```

**Step 3: Create CaaSClient object**

```
client = CaaSClient(credentials, page_size=500)
```

**Step 4**: **Connect to inventory API and execute (alternative API )**

```
inv = client.assetInventory()
```

## Step 5: **Get the number of rows in inventory table** <a href="#step-5-get-the-number-of-rows-in-inventory-table" id="step-5-get-the-number-of-rows-in-inventory-table"></a>

**Step 6: Get number of modules in inventory**

```
count = inv.count(cfxql_query="Equipment_Type is 'MODULE'")
```

**Step 7: Using Inventory API get all CHASSIS (return value is a pandas DataFrame object)**

```
df = inv.get_data(cfxql_query="Equipment_Type is 'CHASSIS'", max_rows=1000)
```

Now you can query the dataframe df using normal Pandas functions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudfabrix.io/rda/rda-python-api/rda-python-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
