Python client for tabroom.com API
Project description
Tabroom Python Client
A type-safe Python client library for the Tabroom.com API. Built with Pydantic for data validation and Requests for reliable HTTP requests.
Features
- Type-safe: All API responses are validated with Pydantic models
- Organized: Resources grouped by domain (user, tournaments, tabulation, etc.)
- Easy to use: Fluent API with method chaining for nested resources
- Well-documented: Comprehensive docstrings and examples
- Error handling: Custom exceptions for different error types
- Context manager support: Automatic connection cleanup
Installation
pip install tabroom
Quick Start
from tabroom import TabroomClient
# Initialize the client
client = TabroomClient(
username="your_email@example.com",
password="your_password"
)
# Get your profile
profile = client.user.get_profile()
print(f"Logged in as: {profile.first} {profile.last}")
# Search for tournaments
tournaments = client.public.search_tournaments("future", "TOC")
print(f"Found {len(tournaments)} tournaments")
# Don't forget to close the connection
client.close()
# Or use as context manager (auto-closes)
with TabroomClient(username="user", password="pass") as client:
profile = client.user.get_profile()
API Resources
The client organizes API endpoints into logical resource groups:
User (client.user)
get_profile()- Get your user profileget_profile_by_id(person_id)- Get another user's profile
Public (client.public)
search_tournaments(time, search_string, circuit_id=None)- Search tournamentsget_upcoming_tournaments(circuit=None)- List upcoming tournamentsget_ads()- Get front page advertisementsget_tournament_by_id(tourn_id)- Get tournament by IDget_tournament_by_webname(webname)- Get tournament by webname
Tab (client.tab)
Tournament tabulation operations with nested resources:
# Tournament-level operations
client.tab.tournament(tourn_id).get_dashboard()
client.tab.tournament(tourn_id).get_attendance()
client.tab.tournament(tourn_id).mark_attendance(data)
client.tab.tournament(tourn_id).get_category_checkin(category_id)
# Round-level operations
client.tab.tournament(tourn_id).round(round_id).get_dashboard()
client.tab.tournament(tourn_id).round(round_id).get_attendance()
client.tab.tournament(tourn_id).round(round_id).mark_attendance(data)
# Timeslot-level operations
client.tab.tournament(tourn_id).timeslot(timeslot_id).get_dashboard()
client.tab.tournament(tourn_id).timeslot(timeslot_id).get_attendance()
Access (client.access)
Permission management with hierarchical access control:
# Tournament-level access
client.access.tournament(tourn_id).grant(person_id, permissions)
client.access.tournament(tourn_id).revoke(person_id)
# Event-level access
client.access.tournament(tourn_id).event(event_id).grant(person_id, permissions)
client.access.tournament(tourn_id).event(event_id).revoke(person_id)
# Category-level access
client.access.tournament(tourn_id).category(category_id).grant(person_id, permissions)
client.access.tournament(tourn_id).category(category_id).revoke(person_id)
Caselist (client.caselist)
get_students(person_id)- Get students for a personget_rounds(person_id)- Get rounds for a personget_chapters(person_id)- Get chapters for a personcreate_link(data)- Create a caselist link
NSDA (client.nsda)
get_history(nsda_id)- Get NSDA membership history
Share (client.share)
send_share_file(data)- Send document to docchain
Payment (client.payment)
process_paypal(data)- Process PayPal paymentprocess_authorize(data)- Process Authorize.net payment
System (client.system)
get_status()- Check API statuspost_status(data)- Check API status via POST
Extra (client.extra)
Additional operations not in the official API spec:
from tabroom import DebateEvent
# Get TOC bid information for a specific event
bids = client.extra.get_bids(DebateEvent.POLICY, year="2025")
for bid in bids:
print(f"{bid['school']} - {bid['entry']}: {bid['bids']} bids")
Available Debate Events
The DebateEvent enum provides type-safe event selection:
DebateEvent.LINCOLN_DOUGLASDebateEvent.POLICYDebateEvent.PUBLIC_FORUMDebateEvent.WORLDS_SCHOOLSDebateEvent.DRAMATIC_INTERPDebateEvent.DUO_INTERPDebateEvent.EXTEMPDebateEvent.HUMOROUS_INTERPDebateEvent.INFORMATIVE_SPEAKINGDebateEvent.ORAL_INTERP_OF_LITERATUREDebateEvent.ORIGINAL_ORATORYDebateEvent.PROGRAM_ORAL_INTERPDebateEvent.CONGRESSIONAL_DEBATE
Error Handling
The client provides specific exception types for different errors:
from tabroom import (
TabroomError, # Base exception
TabroomAuthError, # 401/403 errors
TabroomNotFoundError, # 404 errors
TabroomValidationError, # 422 errors
TabroomServerError, # 5xx errors
TabroomAPIError, # Other API errors
)
try:
profile = client.user.get_profile()
except TabroomAuthError:
print("Authentication failed - check credentials")
except TabroomNotFoundError:
print("Resource not found")
except TabroomError as e:
print(f"API error: {e.message}")
Data Models
All API responses are parsed into Pydantic models for type safety:
Person- User profile dataSession- Login session informationInvite- Tournament invitation/detailsEvent- Tournament eventRound- Tournament roundSearch- Search resultStudent- Student informationChapter- Chapter/school chapterAd- Advertisement- And more...
Examples
See the examples/ directory for comprehensive usage examples:
basic_usage.py- Getting startedtournament_management.py- Tabulation operationsaccess_control.py- Permission managementcaselist_nsda.py- Caselist and NSDA integrationerror_handling.py- Error handling patterns
Development
# Install with dev dependencies
uv pip install -e ".[dev]"
# Run type checking
mypy tabroom
# Run tests
pytest
Project Structure
tabroom-python/
├── src/tabroom/
│ ├── __init__.py # Main TabroomClient
│ ├── client.py # Base HTTP client
│ ├── auth.py # Authentication
│ ├── exceptions.py # Custom exceptions
│ ├── types.py # Type definitions (DebateEvent enum)
│ ├── models/ # Pydantic models
│ │ ├── common.py
│ │ ├── auth.py
│ │ ├── user.py
│ │ ├── tournament.py
│ │ ├── school.py
│ │ ├── caselist.py
│ │ └── share.py
│ └── resources/ # API resource groups
│ ├── user.py
│ ├── public.py
│ ├── tab.py
│ ├── access.py
│ ├── caselist.py
│ ├── nsda.py
│ ├── share.py
│ ├── payment.py
│ ├── system.py
│ └── extra.py
├── examples/ # Usage examples
└── tests/ # Test suite
API Documentation
This client is based on the Tabroom API v1. For detailed API documentation, visit the Tabroom API docs.
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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 tabroom-0.1.3.tar.gz.
File metadata
- Download URL: tabroom-0.1.3.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cf2458d62661969dac4be9945e259a7ce8e4c5b4e7824c94a831b31f97a9fbb
|
|
| MD5 |
99cb63589d9cb914b797c09e6e0f5d2c
|
|
| BLAKE2b-256 |
93de62e4738015c66aaf3410bf62e0868d1d30526c0830d22b5c4129d5f83c29
|
File details
Details for the file tabroom-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tabroom-0.1.3-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14d80c37b059a674487e394f24ad99252e289587543e7192b5c8e85ac4c6b4c4
|
|
| MD5 |
48207b884459f228f674ff9941dbed1a
|
|
| BLAKE2b-256 |
0150846e247e3f2750fca181c7fa94f1ba8d62c2d994df3f8ffc3c96bbaf9aeb
|