Official Python SDK for the Vihaya Events platform. Fetch events, register attendees, and verify Razorpay payments with a fully-typed client.
Project description
Vihaya SDK for Python โ Official vihaya-events Client
vihaya-eventsis the official Python SDK for the Vihaya Events platform. Build event listings, attendee registration flows, Razorpay payment verification, ticketing dashboards, analytics pipelines, and backend integrations in Django, Flask, FastAPI, Starlette, Pyramid, Jupyter notebooks, or any Python 3.9+ runtime โ all with full Pydantic v2 type safety and idiomatic Python ergonomics.
Vihaya is the modern events platform for India โ a single stack for event organisers, ticketing, sponsor management, attendee registration, live check-in, and real-time analytics. This SDK is the fastest way to integrate the Vihaya Events API (https://events.vihaya.app) into any Python codebase.
Table of contents
- What is Vihaya?
- Why the Vihaya Python SDK?
- The Vihaya SDK family
- Installation
- Get your Vihaya API key
- Quick start
- Core concepts
- Usage guide
- Framework integrations
- Mega events & sub-events
- Razorpay payment flow
- API reference
- Models
- Error handling
- Security best practices
- FAQ
- Keywords
- Development
- Contributing
- License
๐ฎ๐ณ What is Vihaya?
Vihaya is an all-in-one events platform for India, built for organisers who run college fests, hackathons, conferences, workshops, meetups, bootcamps, summits, and corporate events. The Vihaya platform provides:
- ๐๏ธ Event creation & ticketing with pricing tiers (Early Bird, Student, VIP, Group), promo codes, and a fully-hosted checkout.
- ๐ข Mega events โ bundle dozens of sub-events (workshops, competitions, talks) under one parent fest.
- ๐ณ Razorpay payments โ integrated end-to-end with server-side signature verification.
- ๐ Custom registration fields โ T-shirt size, college name, team members, dietary preferences, accommodation, and more.
- ๐ฅ Attendee management โ real-time registrations, bulk email, WhatsApp broadcasts, CSV exports.
- ๐ฑ Live check-in โ mobile QR scanning with offline-first sync.
- ๐ฉโ๐ซ Speakers, agenda, sponsors, FAQs โ everything needed for a rich public event page.
- ๐ Analytics โ registrations over time, revenue, tier breakdowns, funnel tracking.
- ๐ Broadcasts โ push updates to all attendees via email, SMS, and WhatsApp.
The Vihaya Events API โ and this vihaya-events package โ lets Python developers embed that platform into their own backend services, data pipelines, Django sites, FastAPI microservices, Streamlit dashboards, and Jupyter notebooks.
Production URL: https://events.vihaya.app ยท Marketing site: https://vihaya.app ยท Developer dashboard: https://events.vihaya.app/profile/developer
โจ Why the Vihaya Python SDK?
- ๐ Fully typed โ every response is a Pydantic v2 model with autocomplete and runtime validation.
- โก Built on
httpxโ HTTP/2 support, connection pooling, and both sync and async-friendly design. - ๐ Pythonic โ snake_case everywhere, context-manager support, idiomatic error handling.
- ๐ฆ Small surface โ
Vihaya,RegisterData,VihayaErrorโ learn it in one sitting. - ๐งช Tested against the live
events.vihaya.appproduction API on every release. - ๐๏ธ Forward-compatible โ Pydantic
extra="allow"preserves new fields the server adds between releases. - ๐งฉ Plays nicely with Django, Flask, FastAPI, Starlette, Litestar, Celery, Airflow, and Jupyter.
- ๐ณ Razorpay ready โ
events.register()โ Razorpay โpayments.verify()in three lines.
๐ The Vihaya SDK family (7 languages)
The Vihaya Events API has seven official SDKs โ all feature-compatible, all maintained in lockstep, all talking to the same events.vihaya.app production API.
| Language | Package | Repository | Install |
|---|---|---|---|
| ๐ Python | vihaya-events |
Vishnu252005/vihaya-sdk-python | pip install vihaya-events |
| ๐จ JavaScript / TypeScript | vihaya-sdk |
Vishnu252005/vihaya-sdk | npm install vihaya-sdk |
| ๐ฆซ Go | vihaya-sdk-go |
Vishnu252005/vihaya-sdk-go | go get github.com/Vishnu252005/vihaya-sdk-go |
| โ Java | vihaya-sdk-java |
Vishnu252005/vihaya-sdk-java | JitPack / Gradle / Maven |
| ๐ Ruby | vihaya-events |
Vishnu252005/vihaya-sdk-ruby | gem install vihaya-events |
| ๐ PHP | vihaya/events |
Vishnu252005/vihaya-sdk-php | composer require vihaya/events |
| ๐ฑ Flutter / Dart | vihaya_sdk_flutter |
Vishnu252005/vihaya-sdk-flutter | flutter pub add vihaya_sdk_flutter |
All Vihaya SDKs target the same API base URL (https://events.vihaya.app), authenticate with the same x-api-key header, and expose the same methods: events.list(), events.get(), events.register(), payments.verify().
๐ฆ Installation
pip install vihaya-events
Or with your favourite tool:
poetry add vihaya-events
pipenv install vihaya-events
uv add vihaya-events
pdm add vihaya-events
conda install -c conda-forge vihaya-events # coming soon
Requirements:
- Python 3.9, 3.10, 3.11, 3.12, 3.13+
httpx >= 0.27pydantic >= 2.5
Install name: vihaya-events. Import name: vihaya.
from vihaya import Vihaya, RegisterData, VihayaError
๐ Get your Vihaya API key
- Sign up or log in at events.vihaya.app.
- Open the Developer Dashboard.
- Click Generate API Key and copy the
vh_live_...token. - Store it in an environment variable โ never commit it to git.
export VIHAYA_API_KEY=vh_live_xxxxxxxxxxxxxxxxxxxxxxxx
๐ Quick start
import os
from vihaya import Vihaya
vh = Vihaya(os.environ["VIHAYA_API_KEY"])
for event in vh.events.list():
print(f"{event.title} โ {event.location} on {event.date}")
Use it as a context manager to guarantee the HTTP connection pool is closed cleanly:
with Vihaya("vh_live_...") as vh:
event = vh.events.get("evt_8x42j9")
print(event.title, event.date, event.location)
Register an attendee
from vihaya import RegisterData
data = 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", data)
if result.get("isPaid"):
print("Razorpay order ID:", result["orderId"])
else:
print("Free registration confirmed:", result["registrationId"])
Verify a Razorpay payment (server-side)
vh.payments.verify(
payment_id="pay_O8K2...",
order_id=result["orderId"],
signature="signature_from_razorpay",
)
๐งญ Core concepts
Events
Every record in Vihaya is an Event โ title, description, date, venue, banner, tiers, custom fields, speakers, agenda, sponsors, FAQs, and sub-events. The Python SDK models this as a vihaya.Event Pydantic model.
Mega events
A mega event is a parent event that contains multiple sub-events. A college fest with 40 workshops is one mega event with 40 sub-events. Access them via event.sub_events.
Registrations
A registration is an attendee entry โ free or paid, with optional custom fields, team members, dietary preferences, and accommodation. Submit via events.register().
Payments
Paid registrations create a Razorpay order; verify the callback signature via payments.verify() on your backend.
API key
All Vihaya requests authenticate via the x-api-key header. Keep your vh_live_... key in an env var, a secrets manager, or your cloud KMS โ never in source.
๐ Usage guide
Fetch a full event
events.get() returns an Event with every piece of metadata the organiser has configured โ speakers, agenda, sponsors, FAQs, custom fields, pricing tiers, and sub-events.
event = vh.events.get("evt_8x42j9")
print(event.title)
print(f"Mode: {event.event_mode} Timezone: {event.timezone}")
print(f"Location: {event.location}")
print(f"Date: {event.date} {event.time}")
for speaker in event.speaker_list or []:
print(f"- {speaker.name} ({speaker.role}) @ {speaker.company}")
for item in event.agenda_list or []:
print(f"[{item.time}] {item.title} โ {item.speaker}")
for sponsor in event.sponsors or []:
print(f"{sponsor.name} ({sponsor.tier})")
for faq in event.faqs or []:
print(f"Q: {faq.question}\nA: {faq.answer}\n")
for tier in event.special_prices or []:
print(f" {tier.name}: โน{tier.amount}")
for field in event.custom_fields or []:
print(f" {field.name} [{field.type}] required={field.required}")
List & filter events
events = vh.events.list()
# Upcoming only
from datetime import datetime
upcoming = [e for e in events if datetime.fromisoformat(e.date) > datetime.now()]
# Mega events
mega = [e for e in events if e.event_type == "megaEvent"]
# Free events
free = [e for e in events if e.is_free]
# Online events
online = [e for e in events if e.event_mode == "online"]
Register a paid attendee with tiers, custom fields, and promo code
result = vh.events.register(
"evt_8x42j9",
RegisterData(
name="Priya Raj",
email="priya@example.com",
phone="+919820012345",
tier="Early Bird",
promo_code="LAUNCH10",
custom_fields={
"College": "IIT Bombay",
"T-Shirt Size": "M",
"Year of Study": "3rd",
},
),
)
Register a team for a hackathon
result = vh.events.register(
"evt_hackathon_2026",
{
"name": "Team Lead",
"email": "lead@example.com",
"phone": "+919820012345",
"teamName": "Byte Squad",
"teamMembers": [
{"name": "Alice", "email": "alice@example.com", "phone": "+91..."},
{"name": "Bob", "email": "bob@example.com", "phone": "+91..."},
{"name": "Carol", "email": "carol@example.com", "phone": "+91..."},
],
},
)
You can always pass a plain dict instead of RegisterData โ camelCase keys go straight to the API.
๐จ Framework integrations
Django view
# views.py
from django.http import JsonResponse
from django.conf import settings
from vihaya import Vihaya
def event_list(request):
with Vihaya(settings.VIHAYA_API_KEY) as vh:
events = vh.events.list()
return JsonResponse([e.model_dump() for e in events], safe=False)
def event_detail(request, event_id):
with Vihaya(settings.VIHAYA_API_KEY) as vh:
event = vh.events.get(event_id)
return JsonResponse(event.model_dump())
Django REST Framework view
from rest_framework.views import APIView
from rest_framework.response import Response
from django.conf import settings
from vihaya import Vihaya, RegisterData, VihayaError
class RegisterView(APIView):
def post(self, request, event_id):
try:
with Vihaya(settings.VIHAYA_API_KEY) as vh:
result = vh.events.register(
event_id,
RegisterData(**request.data),
)
return Response(result)
except VihayaError as e:
return Response({"error": e.message}, status=e.status or 500)
Flask
from flask import Flask, jsonify, request
from vihaya import Vihaya, RegisterData
app = Flask(__name__)
vh = Vihaya(os.environ["VIHAYA_API_KEY"])
@app.get("/events")
def list_events():
return jsonify([e.model_dump() for e in vh.events.list()])
@app.post("/events/<event_id>/register")
def register(event_id):
data = RegisterData(**request.json)
return jsonify(vh.events.register(event_id, data))
FastAPI
from fastapi import FastAPI, Depends, HTTPException
from vihaya import Vihaya, RegisterData, VihayaError
app = FastAPI()
def get_vihaya() -> Vihaya:
return Vihaya(os.environ["VIHAYA_API_KEY"])
@app.get("/events")
def list_events(vh: Vihaya = Depends(get_vihaya)):
return vh.events.list()
@app.get("/events/{event_id}")
def get_event(event_id: str, vh: Vihaya = Depends(get_vihaya)):
try:
return vh.events.get(event_id)
except VihayaError as e:
raise HTTPException(status_code=e.status or 500, detail=e.message)
@app.post("/events/{event_id}/register")
def register(event_id: str, data: RegisterData, vh: Vihaya = Depends(get_vihaya)):
return vh.events.register(event_id, data)
Celery background task
from celery import shared_task
from vihaya import Vihaya, RegisterData
@shared_task
def process_registration(event_id: str, payload: dict):
with Vihaya(os.environ["VIHAYA_API_KEY"]) as vh:
return vh.events.register(event_id, RegisterData(**payload))
Jupyter notebook / Streamlit dashboard
import pandas as pd
from vihaya import Vihaya
with Vihaya("vh_live_...") as vh:
events = vh.events.list()
df = pd.DataFrame([e.model_dump() for e in events])
df[["title", "date", "location", "price", "event_mode"]]
๐ข Mega events & sub-events
fest = vh.events.get("evt_mega_fest_2026")
if fest.event_type == "megaEvent":
print(f"{fest.title} โ {len(fest.sub_events or [])} sub-events")
for sub in fest.sub_events or []:
price = "Free" if sub.is_free else f"โน{sub.price}"
print(f" - {sub.title} ({price})")
# Each sub-event has its own custom fields and tiers
for field in sub.custom_fields or []:
print(f" * {field.name} [{field.type}]")
Register for a specific sub-event:
vh.events.register(
"evt_sub_workshop_ml",
RegisterData(name="Rahul", email="rahul@example.com", phone="+91..."),
)
๐ณ Razorpay payment flow
Vihaya uses Razorpay under the hood. The flow:
- Backend โ
vh.events.register(event_id, data)โ Vihaya creates a Razorpay order and returnsorderId. - Frontend โ launch Razorpay Checkout with that
orderId. - Razorpay callback โ hands back
razorpay_payment_id,razorpay_order_id,razorpay_signature. - Backend โ
vh.payments.verify(...)confirms the signature and marks the registration paid.
# Step 1: create order
result = vh.events.register("evt_conf_2026", RegisterData(
name="Attendee", email="a@example.com", phone="+91...",
))
order_id = result["orderId"]
# Step 2-3: (frontend) โ Razorpay Checkout with order_id, get payment_id + signature
# Step 4: verify
vh.payments.verify(
payment_id=razorpay_payment_id,
order_id=razorpay_order_id,
signature=razorpay_signature,
)
โ ๏ธ Always verify payments on the server. A signature check performed only in the browser can be spoofed.
๐ API reference
Vihaya(api_key, *, base_url=..., headers=..., timeout=30.0)
The main client. All arguments after api_key are keyword-only.
| Parameter | Type | Description |
|---|---|---|
api_key |
str |
Required. Sent as the x-api-key header on every request. |
base_url |
str |
Override for staging. Defaults to https://events.vihaya.app. |
headers |
dict |
Extra headers attached to every request. |
timeout |
float |
Per-request timeout in seconds. Default 30. |
Context-manager supported: with Vihaya(...) as vh: releases the httpx connection pool on exit.
vh.events
| Method | Returns | Description |
|---|---|---|
list() |
list[Event] |
All events on the authenticated account. |
get(event_id) |
Event |
Full metadata for one event โ tiers, custom fields, speakers, agenda, sponsors, FAQs, sub-events. |
register(event_id, data) |
dict |
Submit a registration. data can be RegisterData or a plain dict. Returns orderId (paid) or registrationId (free). |
vh.payments
| Method | Returns | Description |
|---|---|---|
verify(*, payment_id, order_id, signature, amount=None) |
dict |
Server-side Razorpay signature verification. Raises VihayaError on mismatch. |
๐งฌ Models
All models are Pydantic v2 models with extra="allow" โ new fields the API adds between releases are preserved as extra attributes without requiring an SDK bump.
Eventโ root event shape with all metadataSpeakerโname,role,company,bio,photo_urlSponsorโname,tier,logo_url,websiteAgendaItemโtime,title,description,speakerFAQItemโquestion,answerContactโname,email,phoneCustomFieldโname,type,required,optionsSpecialPriceโname,amount,descriptionPromoCodeโcode,discount,discount_typeRegisterDataโ registration payload (can also pass plaindict)
๐จ Error handling
All API failures raise VihayaError with the HTTP status and raw response 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) # raw parsed JSON body, if any
Common status codes:
401โ missing or invalid API key403โ insufficient permissions404โ event/registration not found409โ duplicate registration / capacity full422โ validation error429โ rate limited500โ server error
๐ก๏ธ Security best practices
Never hard-code a
vh_live_...key in source code.
- Use environment variables (
VIHAYA_API_KEY), Django settings, AWS Secrets Manager, GCP Secret Manager, or HashiCorp Vault. - Call
events.register()andpayments.verify()from backend code only โ never from a browser, mobile app, or desktop client. - Always verify Razorpay signatures on your server before trusting any
payment_id. - Rotate keys immediately in the Vihaya developer dashboard if you suspect a leak.
- Use separate keys for staging and production.
โ FAQ
What is Vihaya?
Vihaya is an events platform for India โ ticketing, registrations, payments, check-in, analytics, and attendee management for everything from college fests to corporate conferences. The platform lives at vihaya.app, the organiser dashboard at events.vihaya.app.
Is vihaya-events free?
Yes. The Python SDK is MIT-licensed. You only pay Vihaya platform fees when you sell tickets.
What's the difference between install name and import name?
You install with pip install vihaya-events but import with from vihaya import .... This is a common Python packaging pattern โ it avoids colliding with the PyPI namespace while keeping imports short.
Does the SDK support async?
The current public interface is synchronous (built on httpx.Client). An async variant (vihaya.aio.Vihaya) is on the roadmap. For now, run sync calls in a thread pool executor or inside Celery tasks.
Does the Python SDK support the Razorpay test mode?
Yes โ use a test API key from the Vihaya developer dashboard.
Can I use this with Jupyter, Streamlit, Dash, or Airflow?
Yes. The SDK is a plain Python package โ works anywhere Python runs.
Can I pass a plain dict instead of RegisterData?
Yes. RegisterData is a convenience wrapper โ dict works too, as long as you use camelCase keys (customFields, teamMembers, etc.).
๐ Keywords
vihaya ยท vihaya sdk ยท vihaya events ยท vihaya events sdk ยท vihaya api ยท vihaya python ยท vihaya python sdk ยท vihaya-events ยท vihaya ticketing sdk ยท vihaya registration api ยท vihaya razorpay ยท events api python ยท event management sdk python ยท ticketing api python ยท college fest sdk ยท hackathon registration python ยท conference ticketing python ยท razorpay events python ยท django events sdk ยท flask events sdk ยท fastapi events sdk ยท events.vihaya.app python ยท vihaya official python sdk ยท vihaya client library python
๐ ๏ธ Development
git clone https://github.com/Vishnu252005/vihaya-sdk-python.git
cd vihaya-sdk-python
pip install -e ".[dev]"
pytest
ruff check .
mypy src
Pull requests welcome โ see the contributing guide below.
๐ค Contributing
Contributions to the Vihaya Python SDK are very welcome. The project is open source and MIT-licensed.
- Fork Vishnu252005/vihaya-sdk-python.
- Create a feature branch:
git checkout -b feature/amazing-feature. - Run
pytest,ruff check ., andmypy srcto ensure the test suite still passes. - Commit and push.
- Open a Pull Request.
Reporting issues
Found a bug or have a feature request? Open an issue at github.com/Vishnu252005/vihaya-sdk-python/issues.
๐ License
MIT ยฉ Vihaya. See LICENSE.
๐ฌ Support
- ๐ง Email: support@vihaya.app
- ๐ Website: vihaya.app
- ๐ ๏ธ Dashboard: events.vihaya.app
- ๐จโ๐ป Developer docs: events.vihaya.app/profile/developer/docs
- ๐ Issues: github.com/Vishnu252005/vihaya-sdk-python/issues
Built with โค๏ธ by the Vihaya team.
Related Vihaya SDK repositories
- Python: vihaya-sdk-python โ you are here
- JavaScript / TypeScript: vihaya-sdk
- Go: vihaya-sdk-go
- Java: vihaya-sdk-java
- Ruby: vihaya-sdk-ruby
- PHP: vihaya-sdk-php
- Flutter: vihaya-sdk-flutter
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vihaya_events-0.1.1.tar.gz.
File metadata
- Download URL: vihaya_events-0.1.1.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af1d7ed0c7938b08279af885cebffdb5194853e847dfb212083dd0b59253f7d
|
|
| MD5 |
c00fb0ccf641cee2166a32c6d3164a1d
|
|
| BLAKE2b-256 |
4945d73dc120e5266e8870c3c59257f926d4c54e6560f8d4fec1a87e4ffc9c45
|
File details
Details for the file vihaya_events-0.1.1-py3-none-any.whl.
File metadata
- Download URL: vihaya_events-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098f620e59580f6fc05e84d8265a01022be3c7cebe2a26d1d8302509d35a2f0a
|
|
| MD5 |
830d5493cdadf1d4de751ffa5645f979
|
|
| BLAKE2b-256 |
41d696a4417081dbf83a26f077837bbbfcc02828e5f2fc92c13cbb28e1efd479
|