Python
Python Quickstart
Get started with the Fortress Python SDK
Here is the GitHub repository.
Quickstart
Prerequisites
Before you begin, make sure you have:
- A Fortress account
- Connection to your cloud account
- Your API token
- Your Organization ID
You can find your API token and Organization ID in the Fortress dashboard under the API Keys section.
Installation
Install the SDK using pip:
pip install fortress-sdk-python
Example Usage
from fortress_sdk_python import Fortress
# Initialize the client with your API key
client = Fortress(org_id='your_org_id', api_key='your_api_key')
# Connect to a database
conn = client.connect_tenant(tenant_name='client1')
cursor = conn.cursor()
# Execute a query to fetch all rows from a table
results = cursor.execute('SELECT * FROM your_table_name').fetchall()
# Print the results
for row in results:
print(row)
# Close the connection
conn.close()