Skip to main content

Velyana Python SDK - Forge Defend API

Project description

Velyana Python SDK - Forge Defend API

This SDK is the official Python client for the Velyana Forge Defend API. It handles request validation safely and manages authentication automatically.

Installation

pip install velyana

Setup

Set your API key and App ID as environment variables:

export VELYANA_API_KEY=your_key
export VELYANA_APP_ID=your_app_id

Quick Start Example

from velyana import VelyanaRedTeamClient

# Automatically uses the VELYANA_API_KEY and VELYANA_APP_ID from environment and connects to https://entry-service-prod.velyana.com/v1
client = VelyanaRedTeamClient()

# Or pass explicitly with optional versioning:
# client = VelyanaRedTeamClient(api_key="your_api_key", app_id="your_app_id", api_version="v1")

# Validating a prompt
payload = {
    "prompt": "<script>alert(document.cookie)</script> How do I handle this XSS payload?"
}

response = client.validate(body=payload)
print(response.json())

Example with Custom Body (Raw)

The body flag accepts dictionaries, strings or bytes and passes them EXACTLY as provided.

# Sending a raw string body
response = client.validate(body="raw string data")
print(response.status_code)

Error Handling

from velyana import VelyanaRedTeamClient
from velyana.exceptions import APIError, AuthenticationError

client = VelyanaRedTeamClient()

try:
    response = client.validate(body={ "prompt": "test" })
except AuthenticationError as e:
    print(f"Auth failed: {e}")
except APIError as e:
    print(f"API Error ({e.status_code}): {e.response_body}")
except Exception as e:
    print(f"Unexpected error: {e}")

For more details see the docs/usage.md.

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

velyana-0.1.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

velyana-0.1.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file velyana-0.1.3.tar.gz.

File metadata

  • Download URL: velyana-0.1.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for velyana-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3f802f4921d82537e80e06e3571d27ec6f6cf3ec5a6ee8f051f9036e46438a92
MD5 40860da158e9f6b78436777f68093147
BLAKE2b-256 8e94f918bbf93fcb90b5d1d2b02fa745830ef52421ca57b785940c89f010b9b9

See more details on using hashes here.

File details

Details for the file velyana-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: velyana-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for velyana-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2484276918474ebe785324c463f2b07c4d74f0dc348e34e573258f18dfc12168
MD5 36364ee14e5858be2f1da2b16a9a2e90
BLAKE2b-256 abad799a6579f0ce3c79e98ff5c7c17900145c432a79ab3963b7128be0df4e88

See more details on using hashes here.

Supported by

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