Skip to main content

No project description provided

Project description

CyClarity SDK

Introduction

CyClarity SDK is a Python package that provides an interface for interacting with the CyClarity platform. It includes classes and methods for creating, managing, and interacting with various resources on the platform.

Installation

You can install the CyClarity SDK using pip:

pip install cyclarity-sdk

Usage

Here are examples of how to use the classes in the CyClarity SDK. Runnable The Runnable class is a base class for creating objects that can be run with setup and teardown phases. It has setup, run, and teardown methods that need to be implemented. Here is an example:

from cyclarity_sdk.runnable import Runnable, BaseResultsModel

class MyResult(BaseResultsModel):
res_str: str

class MyRunnable(Runnable[MyResult]):
desc: str
cli_args: str

def setup(self):  
    self.logger.info("Setting up")  

def run(self):  
    self.logger.info("Running")  
    self.platform_api.send_test_report_description("This is a test description")  
    return MyResult(res_str="success!")  

def teardown(self, exception_type, exception_value, traceback):  
    self.logger.info("Tearing down")  

To use this Runnable, you would do:

input = {
"desc": "test",
"cli_args": "-as -fsd -dsd",
}

with MyRunnable(**input) as runnable_instance: # noqa
result: MyResult = runnable_instance()

# generates result json object  
print("\ndictionary running results: ")  
print(result.model_dump_json())  

PlatformApi

The PlatformApi class provides methods for interacting with the CyClarity platform. It is used within a Runnable instance through self.platform_api attribute. Here are the methods it supports:

send_test_report_description(description): This method sends a test report description to the platform. send_finding(pt_finding): This method sends a finding to the platform. send_execution_state(percentage, status, error_message): This method sends the execution state to the platform.

Here is how you might use PlatformApi in a Runnable:

class MyRunnable(Runnable[MyResult]):
desc: str
cli_args: str

def setup(self):  
    self.logger.info("Setting up")  

def run(self):          self.logger.info("Running")  
    self.platform_api.send_test_report_description("This is a test description")  
    return MyResult(res_str="success!")  

def teardown(self, exception_type, exception_value, traceback):  
    self.logger.info("Tearing down")  

Documentation

For more detailed information about deploying this test to the system, please refer to the official documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cyclarity_sdk-1.0.54.tar.gz (13.7 kB view hashes)

Uploaded Source

Built Distribution

cyclarity_sdk-1.0.54-py3-none-any.whl (20.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page