Skip to main content

A comprehensive Python wrapper for the Walver API

Project description

Walver.io SDK

A Python SDK for interacting with the Walver API, providing both synchronous and asynchronous clients for creating and managing wallet verification links.

Installation

pip install walver-sdk

Quick Start

Getting an API Key

Go to walver.io, register for an account and get an api key in the creator dashboard

Using the Synchronous Client

from walver_sdk import Walver

# Initialize the client
walver = Walver(api_key="your-api-key")

# Create a verification
verification = walver.create_verification(
    id="verification_123",
    service_name="My Service", #Users will see this
    chain="solana",
    custom_fields=[
        {
            "id": "email",
            "type": "email",
            "name": "Email Address",
            "required": True
        }
    ]
)

# Create a folder
folder = walver.create_folder(
    name="My Folder",
    description="A folder for organizing verifications",
    custom_fields=[
        {
            "id": "discord",
            "type": "discord",
            "name": "Discord Username",
            "required": True
        }
    ]
)

# Get all folders
folders = walver.get_folders()

# Get verifications in a folder
verifications = walver.get_folder_verifications(folder_id="folder_123")

# Create an API key
api_key = walver.create_api_key(
    name="My API Key",
    description="API key for production use"
)

# Get all API keys
api_keys = walver.get_api_keys()

# Delete an API key
walver.delete_api_key(api_key="key_123")

Using the Asynchronous Client

import asyncio
from walver_sdk import AsyncWalver

async def main():
    # Initialize the client
    walver = AsyncWalver(api_key="your-api-key")

    # Create a verification with token gating
    verification = await walver.create_verification(
        id="verification_123",
        service_name="My Service", #Users will see this
        chain="solana",
        token_gate=True,
        token_address="So11111111111111111111111111111111111111112",
        token_amount=1.0,
        custom_fields=[
            {
                "id": "email",
                "type": "email",
                "name": "Email Address",
                "required": True
            }
        ]
    )

    # Create a folder
    folder = await walver.create_folder(
        name="My Folder",
        description="A folder for organizing verifications"
    )

    # Get all folders
    folders = await walver.get_folders()

    # Get verifications in a folder
    verifications = await walver.get_folder_verifications(folder_id="folder_123")

    # Create an API key
    api_key = await walver.create_api_key(
        name="My API Key",
        description="API key for production use"
    )

    # Get all API keys
    api_keys = await walver.get_api_keys()

    # Delete an API key
    await walver.delete_api_key(api_key="key_123")

# Run the async code
asyncio.run(main())

Configuration

API Key

You can provide the API key in two ways:

  1. Pass it directly when initializing the client:
walver = Walver(api_key="your-api-key")
  1. Set it as an environment variable in your .env file:
WALVER_API_KEY=your-api-key

Base URL

By default, the client uses https://walver.io/api/. You can change this by passing the base_url parameter:

walver = Walver(
    api_key="your-api-key",
    base_url="https://walver.io/our-next-url"
)

Timeout

The default timeout is 10 seconds. You can change this by passing the timeout parameter:

walver = Walver(
    api_key="your-api-key",
    timeout=30  # 30 seconds timeout
)

Features

Verification Creation

Create verifications with various options:

verification = walver.create_verification(
    id="verification_123",
    service_name="My Service", #Users will see this
    chain="solana",
    webhook="https://your-webhook-url.com/webhook",
    secret="your-webhook-secret",
    redirect_url="https://your-redirect-url.com",
    one_time=True,
    custom_fields=[
        {
            "id": "email",
            "type": "email",
            "name": "Email Address",
            "required": True
        },
        {
            "id": "tg",
            "type": "telegram",
            "name": "Telegram Username",
            "required": False
        }
    ]
)

Token Gating

Create verifications with token gating:

verification = walver.create_verification(
    id="verification_123",
    service_name="My Service", #Users will see this
    chain="solana",
    token_gate=True,
    token_address="So11111111111111111111111111111111111111112",
    token_amount=1.0,
    is_nft=True  # Set to True for NFT verification
)

Email Verification

Require email verification using OTP:

verification = walver.create_verification(
    id="verification_123",
    service_name="My Service",
    chain="solana",
    force_email_verification=True,
    custom_fields=[
        {
            "id": "email",
            "type": "email",
            "name": "Email Address",
            "required": True
        }
    ]
)

Error Handling

The client raises exceptions for various error conditions:

try:
    verification = walver.create_verification(
        id="verification_123",
        service_name="My Service",
        chain="solana",
        token_gate=True  # Missing token_address and token_amount
    )
except ValueError as e:
    print(f"Validation error: {e}")
except requests.exceptions.RequestException as e:
    print(f"API error: {e}")

Best Practices

  1. Webhook Security: Always provide a secret when using webhooks:
verification = walver.create_verification(
    webhook="https://your-webhook-url.com/webhook",
    secret="your-webhook-secret"
)
  1. Async Context Manager: Use the async client with a context manager:
async with AsyncWalver(api_key="your-api-key") as walver:
    verification = await walver.create_verification(...)

License

MIT License

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

walver_sdk-0.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

walver_sdk-0.0.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file walver_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: walver_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for walver_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 136d62ce4086a71221cbfbdbd7bffb923067b33e856f9726ed027c689c3a96aa
MD5 e0e79134362b0cb9c1e498d2bd22752a
BLAKE2b-256 ea64f41cb6a6503b114c90b89df0b81f16f80b92421e71527b3f29c06fcbbeac

See more details on using hashes here.

File details

Details for the file walver_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: walver_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for walver_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3fef411b21e97bd6aac190cf68c63fbe2cbaff471b7b68965adb94bed0b42e1
MD5 68608db531cf6fd20780a0a583d922c9
BLAKE2b-256 5e96c3865fdce078bc532655e033458250f1b0719f6105a4fbec8abd1afb7020

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