Skip to content

Getting Started

To get started with the Netorca SDK, follow these steps:

Import Necessary Modules

# Import necessary modules
from netorca_sdk.auth import NetorcaAuth
from netorca_sdk.netorca import Netorca

Initialize Authentication

Create an instance of the NetorcaAuth class by providing either a username and password or an API key and your netorca base_url.

# Using Username and Password
auth = NetorcaAuth(username="your_username", password="your_password", fqdn="https://your_project_base_url"

# Using API Key
auth = NetorcaAuth(api_key="your_api_key")

Create Netorca Instance

Create an instance of the Netorca class by passing the authentication object created in the previous step.

netorca = Netorca(auth=auth)
Now that you have set up the authentication and created a Netorca instance, you can start using the SDK to interact with Netorca's features and data.

Sample Code

# Import necessary modules
import os
from netorca_sdk.auth import NetorcaAuth
from netorca_sdk.netorca import Netorca

# Initialize the authentication object with your API key and API URL
netorca_auth = NetorcaAuth(api_key=os.environ["api_key"], fqdn=os.environ["url"])

# Create an instance of the Netorca class with the authentication object
netorca = Netorca(auth=netorca_auth)

# Define filters to narrow down the search
filters = {"service_name": "name_of_the_service"}

# Retrieve information about services using the defined filters
services_info = netorca.get_services(filters=filters)

# Print the result
print(services_info)

List of Available Methods

You can find the list of available methods in Netorca SDK PyPi documentation