API Reference¶
Complete reference for all public modules in pretalx-client.
Client¶
- class pretalx_client.client.PretalxClient[source]¶
Bases:
objectHTTP client for the Pretalx REST API.
Provides methods to fetch speakers, talks, and schedule data from a Pretalx event. Handles pagination automatically and supports both authenticated and public access. Returns typed dataclasses rather than raw dicts.
Delegates low-level HTTP operations to the auto-generated
GeneratedPretalxClient.- Parameters:
Example:
client = PretalxClient("pycon-us-2026", api_token="abc123") speakers = client.fetch_speakers() talks = client.fetch_talks() schedule = client.fetch_schedule()
- __init__(event_slug, *, base_url='https://pretalx.com', api_token='')[source]¶
Initialize the client for a specific Pretalx event.
- fetch_event()[source]¶
Fetch metadata for this event.
Returns the raw event dict with keys: name, slug, date_from, date_to, timezone, urls, etc.
- Return type:
- Returns:
A raw event dict from the Pretalx API.
- Raises:
RuntimeError – If the API returns an HTTP error status.
- fetch_rooms_full()[source]¶
Fetch full room data for the event.
Returns all fields from the Pretalx
/rooms/endpoint includingid,name,description,capacity, andposition.
- fetch_speakers()[source]¶
Fetch all speakers for the event.
- Return type:
- Returns:
A list of
PretalxSpeakerinstances.
- fetch_talks(*, submission_types=None, tracks=None, tags=None, rooms=None)[source]¶
Fetch all confirmed/accepted talks for the event.
Delegates to
fetch_talks_with_fallback()for the endpoint selection logic. Tries the/talks/endpoint first. When that returns 404 (as it does for some Pretalx events like PyCon US), falls back to/submissions/withconfirmedandacceptedstates.- Parameters:
submission_types (
dict[int,str] |None) – Optional ID-to-name mapping for submission types.tracks (
dict[int,str] |None) – Optional ID-to-name mapping for tracks.tags (
dict[int,str] |None) – Optional ID-to-name mapping for tags.rooms (
dict[int,str] |None) – Optional ID-to-name mapping for rooms.
- Return type:
- Returns:
A list of
PretalxTalkinstances.
- fetch_submissions(*, state='', submission_types=None, tracks=None, tags=None, rooms=None)[source]¶
Fetch submissions for the event, optionally filtered by state.
- Parameters:
state (
str) – Pretalx submission state to filter by (e.g."confirmed"). When empty, all submissions are returned.submission_types (
dict[int,str] |None) – Optional ID-to-name mapping for submission types.tracks (
dict[int,str] |None) – Optional ID-to-name mapping for tracks.tags (
dict[int,str] |None) – Optional ID-to-name mapping for tags.rooms (
dict[int,str] |None) – Optional ID-to-name mapping for rooms.
- Return type:
- Returns:
A list of
PretalxTalkinstances.
- classmethod fetch_events(*, base_url='https://pretalx.com', api_token='')[source]¶
Fetch all events accessible to the given API token.
Calls
GET /api/events/which does not require an event slug. Returns raw event dicts with keys: name, slug, date_from, date_to, etc.
Data Models¶
- class pretalx_client.models.PretalxSpeaker[source]¶
Bases:
objectA speaker record from the Pretalx API.
- Variables:
code – Unique alphanumeric speaker identifier in Pretalx.
name – Speaker’s display name.
biography – Markdown-formatted biography text.
avatar_url – URL to the speaker’s avatar image.
email – Speaker’s email (only available with authenticated API access).
submissions – List of submission codes this speaker is associated with.
- Parameters:
- classmethod from_api(data)[source]¶
Construct a
PretalxSpeakerfrom a raw Pretalx API dict.Parses through the generated
SpeakerorSpeakerOrgamodel for field validation, then adapts into the consumer-friendly shape. Falls back to direct dict extraction when the generated model cannot handle the API response (e.g.avatarvsavatar_url).
- class pretalx_client.models.PretalxTalk[source]¶
Bases:
objectA talk or submission record from the Pretalx API.
- Variables:
code – Unique alphanumeric submission identifier.
title – Talk title.
abstract – Short summary.
description – Full description.
submission_type – Resolved display name of the submission type.
- track: Resolved display name of the track.
tags: Resolved display names of tags. duration: Duration in minutes. state: Submission lifecycle state. speaker_codes: List of speaker codes linked to this talk. room: Resolved display name of the scheduled room. slot_start: Scheduled start time (ISO 8601). slot_end: Scheduled end time (ISO 8601).
- Parameters:
- classmethod from_api(data, *, submission_types=None, tracks=None, tags=None, rooms=None)[source]¶
Construct a
PretalxTalkfrom a raw Pretalx API dict.Parses through the generated
Submissionmodel for field validation, then resolves integer IDs to display names via the adapter layer. Falls back to direct dict extraction when the generated model cannot handle the API response shape.- Parameters:
data (
dict[str,Any]) – A single submission or talk object from the Pretalx API.submission_types (
dict[int,str] |None) – Optional{id: name}mapping for resolving integer submission type IDs.tracks (
dict[int,str] |None) – Optional{id: name}mapping for resolving integer track IDs.tags (
dict[int,str] |None) – Optional{id: name}mapping for resolving integer tag IDs.rooms (
dict[int,str] |None) – Optional{id: name}mapping for resolving integer room IDs.
- Return type:
- Returns:
A populated
PretalxTalkinstance.
- __init__(code, title, abstract='', description='', submission_type='', track='', tags=<factory>, duration=None, state='', speaker_codes=<factory>, room='', slot_start='', slot_end='')¶
- class pretalx_client.models.PretalxSlot[source]¶
Bases:
objectA schedule slot from the Pretalx schedule API.
- Variables:
room – Resolved display name of the room.
start – Slot start time as an ISO 8601 string.
end – Slot end time as an ISO 8601 string.
code – Submission code if this slot holds a talk, empty otherwise.
title – Resolved display title for the slot.
start_dt – Parsed start datetime, or
Noneif unparsable.end_dt – Parsed end datetime, or
Noneif unparsable.
- Parameters:
- classmethod from_api(data, *, rooms=None)[source]¶
Construct a
PretalxSlotfrom a raw Pretalx schedule slot dict.Validates the raw dict through the generated
TalkSlotmodel, then delegates tonormalize_slot()for field extraction and normalization.Handles both the legacy format (string
room,code,titlekeys) and the real paginated/slots/format (integerroomID,submissionkey instead ofcode, notitle).
- class pretalx_client.models.SubmissionState[source]¶
Bases:
StrEnumPretalx submission lifecycle states.
Values are sourced from the OpenAPI-generated
StateEnumwhere available, withDELETEDadded for states observed in practice but absent from the published schema.- SUBMITTED = 'submitted'¶
- ACCEPTED = 'accepted'¶
- REJECTED = 'rejected'¶
- CONFIRMED = 'confirmed'¶
- WITHDRAWN = 'withdrawn'¶
- CANCELED = 'canceled'¶
- DRAFT = 'draft'¶
- DELETED = 'deleted'¶
- __new__(value)¶
Adapters¶
Normalization helpers for Pretalx multilingual and ID-based fields. |
|
Schedule slot parsing and datetime normalization for Pretalx API data. |