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 ForgeDefendClient

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

# Or pass explicitly with optional versioning:
# client = ForgeDefendClient(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 ForgeDefendClient
from velyana.exceptions import APIError, AuthenticationError

client = ForgeDefendClient()

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.4.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.4-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: velyana-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 c7b76ca40d9c74246c8621fea411c3b2c67a7dc415a97a67082f47198a869839
MD5 67ad081fa49ea987d8122b897f1f245f
BLAKE2b-256 ef611494e01aa64f75626de162e439583071cb7792dac2661b1a8c18ca72c070

See more details on using hashes here.

File details

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

File metadata

  • Download URL: velyana-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 93955f97e9a4ee17fe46685f64ad88eeea98638b57771b368349633d7dfcb40d
MD5 6f0a5fe860960753cd9d1a8cd0ee1d7f
BLAKE2b-256 68b0a6b6582fd13ec820c5cb912e2cbf802da55ac27edc85596e9efde583cbd9

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