Skip to main content

Official Python SDK for the Vihaya Events platform. Fetch events, register attendees, and verify Razorpay payments with a fully-typed client.

Project description

Vihaya Events — Python SDK

PyPI version Python versions License: MIT

The official Python SDK for the Vihaya Events platform. Fully typed, built on httpx and Pydantic v2, with feature parity across our JavaScript and Flutter SDKs.

Install

pip install vihaya-events

Requires Python 3.9+.

Quick start

from vihaya import Vihaya

vh = Vihaya("vh_live_...")  # get your key from the developer dashboard

for event in vh.events.list():
    print(f"{event.title}{event.location}")

Use it as a context manager to guarantee the connection pool gets closed:

with Vihaya("vh_live_...") as vh:
    event = vh.events.get("evt_8x42j9")
    print(event.title, event.date)

Fetch a full event

events.get() returns an Event with every piece of metadata the organizer has configured — speakers, agenda, sponsors, FAQs, custom fields, pricing tiers, and sub-events for mega events.

event = vh.events.get("evt_8x42j9")

print(event.title)
print(f"Mode: {event.event_mode}  Timezone: {event.timezone}")

for speaker in event.speaker_list or []:
    print(f"- {speaker.name} ({speaker.role})")

for item in event.agenda_list or []:
    print(f"[{item.time}] {item.title}")

for tier in event.special_prices or []:
    print(f"  {tier.name}: ₹{tier.amount}")

Mega events

If event.event_type == "megaEvent", it contains sub-events. Each sub-event has its own tiers, custom fields, etc.

if event.event_type == "megaEvent":
    for sub in event.sub_events or []:
        price = "Free" if sub.is_free else f"₹{sub.price}"
        print(f"- {sub.title} ({price})")

Register an attendee

from vihaya import RegisterData

registration = RegisterData(
    name="Anjali Mehta",
    email="anjali@example.com",
    phone="+919820012345",
    custom_fields={"T-Shirt Size": "L", "College": "Vihaya Institute"},
)

result = vh.events.register("evt_8x42j9", registration)

if result.get("isPaid"):
    order_id = result["orderId"]
    # Launch Razorpay checkout with this order_id, then verify server-side:
    vh.payments.verify(
        payment_id="pay_xxx",
        order_id=order_id,
        signature="sig_xxx",
    )
else:
    print(f"Registered! ID: {result['registrationId']}")

You can also pass a plain dict instead of RegisterData if you prefer.

Error handling

All API failures raise VihayaError with the status code and raw body:

from vihaya import VihayaError

try:
    vh.events.get("evt_does_not_exist")
except VihayaError as exc:
    print(f"{exc.message} (status={exc.status})")
    print(exc.data)

API reference

Vihaya(api_key, *, base_url=..., headers=..., timeout=30.0)

The main client. All arguments after api_key are keyword-only.

vh.events

Method Returns Description
list() list[Event] All events on the authenticated account.
get(event_id) Event Full metadata for one event.
register(event_id, data) dict Submit a registration. data can be RegisterData or dict.

vh.payments

Method Returns Description
verify(*, payment_id, order_id, signature, amount=None) dict Server-side Razorpay signature verification.

Security: never hard-code a live secret key in client-side code. Use environment variables and perform payment verification from a trusted backend environment only.

Development

git clone https://github.com/Vishnu252005/vihaya-sdk-python.git
cd vihaya-sdk-python
pip install -e ".[dev]"
pytest

License

MIT — see 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

vihaya_events-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

vihaya_events-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file vihaya_events-0.1.0.tar.gz.

File metadata

  • Download URL: vihaya_events-0.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for vihaya_events-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eae9ad5375ce7d0401f2a2a23b311894c0f11f8bf977bfb0e5336460fedc9c3c
MD5 8bbbf11489f3722de91849c75d05061d
BLAKE2b-256 dd629da89306870b81c2bf80545a1f90fa6437b4f43cf3e6a5d4e36d5f25576b

See more details on using hashes here.

File details

Details for the file vihaya_events-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vihaya_events-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for vihaya_events-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cd90de870b6f8502a9d491b48fd4188cb4749fcf33dbab7f3757e78d5c35bab
MD5 8991c8a02c2d3474417786e5d0edd547
BLAKE2b-256 ebd0ec24617f4e0d063b7393d25457ea50b348587057e7367bfa4ab418cd82b8

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