API Reference

Main Module

Forwarder

class pretix_event_person_forwarder.forwarder.Forwarder[source]

Bases: object

The class includes all necessary methods to forward event persons between Pretix instances

Parameters:
  • source_api_model (APIModel) – Inject an API model object for the source Pretix instance

  • dest_api_model (APIModel) – Inject an API model object for the destination Pretix instance

  • rules (dict) – A dictionary defining the field mapping rules between source and destination

  • mode (str) – The forwarding mode; must be ‘skip’ to skip existing attendees or ‘update’ to patch them

source_api_model

This is where we store the source_api_model

Type:

APIModel

dest_api_model

This is where we store the dest_api_model

Type:

APIModel

rules

This is where we store the rules

Type:

dict

mode

This is where we store the mode

Type:

str

__init__(source_api_model: APIModel, dest_api_model: APIModel, rules: dict, mode: str)[source]
forward_event_persons(source_organizer: str, source_event: str, dest_organizer: str, dest_event: str) None[source]

The method includes a functionality to forward event persons from a source event to a destination event

Parameters:
  • source_organizer (str) – Specify the organizer slug of the source Pretix instance

  • source_event (str) – Specify the event slug on the source Pretix instance

  • dest_organizer (str) – Specify the organizer slug of the destination Pretix instance

  • dest_event (str) – Specify the event slug on the destination Pretix instance

Raises:
  • ValueError – Raised when a destination question ID defined in the rules is not found in the destination event

  • ValueError – Raised when an invalid mode is provided during initialisation

Returns:

None

Models

class pretix_event_person_forwarder.model.APIEndpoints[source]

Bases: Enum

The class includes all necessary API endpoint strings to connect the Pretix API

EVENTS: str = 'events'
ITEMS: str = 'items'
ORDERS: str = 'orders'
ORGANIZERS: str = '/api/v1/organizers'
QUESTIONS: str = 'questions'
api_prefix: str = 'api'
version_1: str = 'v1'
class pretix_event_person_forwarder.model.APIModel[source]

Bases: object

The class includes all necessary variables to establish a connection to the Grafana API endpoints

Parameters:
  • host (str) – Specify the host of the Grafana system

  • token (str) – Specify the access token of the Grafana system

  • username (str) – Specify the username of the Grafana system

  • password (str) – Specify the password of the Grafana system

  • timeout (float) – Specify the timeout of the Grafana system

  • headers (dict) – Specify the headers of the Grafana system

  • http2_support (bool) – Specify if you want to use HTTP/2

  • ssl_context (ssl.SSLContext) – Specify the custom ssl context of the Grafana system

  • num_pools (int) – Specify the number of the connection pool

  • retries (any) – Specify the number of the retries. Please use False as parameter to disable the retries

  • follow_redirects (bool) – Specify if redirections should be followed (default True)

__init__(host: str, token: str = None, username: str = None, password: str = None, headers: dict = None, timeout: float = 10.0, http2_support: bool = False, ssl_context: SSLContext = <ssl.SSLContext object>, num_pools: int = 10, retries: any = 10, follow_redirects: bool = True) None
follow_redirects: bool = True
headers: dict = None
host: str
http2_support: bool = False
num_pools: int = 10
password: str = None
retries: any = 10
ssl_context: SSLContext = <ssl.SSLContext object>
timeout: float = 10.0
token: str = None
username: str = None
class pretix_event_person_forwarder.model.RequestsMethods[source]

Bases: Enum

The class includes all necessary method values to establish an HTTP/ HTTPS connection to the Pretix API endpoints

DELETE: str = 'DELETE'
GET: str = 'GET'
PATCH: str = 'PATCH'
POST: str = 'POST'
PUT: str = 'PUT'

Orders

class pretix_event_person_forwarder.orders.Orders[source]

Bases: object

The class includes all necessary methods to access the Pretix events API endpoints

Parameters:

pretix_api_model (APIModel) – Inject a Grafana API model object that includes all necessary values and information

pretix_api_model

This is where we store the pretix_api_model

Type:

APIModel

__init__(pretix_api_model: APIModel)[source]
get_all_orders(organizer: str) list[source]

The method includes a functionality to get all orders of the specified organizer

Parameters:

organizer (str) – Specify the organizer of the events

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

Returns a list of the events

Return type:

api_call (list)

get_event_orders(organizer: str, event_name: str) list[source]

The method includes a functionality to get all orders of the specified event

Parameters:
  • organizer (str) – Specify the organizer of the events

  • event_name (str) – Specify the event name

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

Returns a list of the events

Return type:

api_call (list)

Events

class pretix_event_person_forwarder.events.Events[source]

Bases: object

The class includes all necessary methods to access the Pretix events API endpoints

Parameters:

pretix_api_model (APIModel) – Inject a Grafana API model object that includes all necessary values and information

pretix_api_model

This is where we store the pretix_api_model

Type:

APIModel

__init__(pretix_api_model: APIModel)[source]
get_event(organizer: str, event_name: str) dict[source]

The method includes a functionality to get a event of the organizer

Parameters:
  • organizer (str) – Specify the organizer of the events

  • event_name (str) – Specify the event name

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

Returns the event

Return type:

api_call (dict)

get_events(organizer: str) list[source]

The method includes a functionality to get all events of the organizer

Parameters:

organizer (str) – Specify the organizer of the events

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

Returns a list of the events

Return type:

api_call (list)

Questions

class pretix_event_person_forwarder.questions.Questions[source]

Bases: object

The class includes all necessary methods to access the Pretix questions API endpoints

Parameters:

pretix_api_model (APIModel) – Inject a Grafana API model object that includes all necessary values and information

pretix_api_model

This is where we store the pretix_api_model

Type:

APIModel

__init__(pretix_api_model: APIModel)[source]
get_all_event_questions(organizer: str, event_name: str) list[source]

The method includes a functionality to get all questions of the specified event

Parameters:
  • organizer (str) – Specify the organizer of the events

  • event_name (str) – Specify the event name

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

Returns a list of the events

Return type:

api_call (list)

get_event_question(organizer: str, event_name: str, question_id: int) dict[source]

The method includes a functionality to get a question of the specified event

Parameters:
  • organizer (str) – Specify the organizer of the events

  • event_name (str) – Specify the event name

  • question_id (int) – Specify the question id

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

Returns a list of the events

Return type:

api_call (list)

API Client

class pretix_event_person_forwarder.api.Api[source]

Bases: object

The class includes all necessary methods to make API calls to the Pretix API endpoints

Parameters:

pretix_api_model (APIModel) – Inject a Pretix API model object that includes all necessary values and information

pretix_api_model

This is where we store the pretix_api_model

Type:

APIModel

__init__(pretix_api_model: APIModel)[source]
call_the_api(api_call: str, method: RequestsMethods = RequestsMethods.GET, json_complete: str = None, org_id_header: int = None, disable_provenance_header: bool = False, response_status_code: bool = False) any[source]

The method execute a defined API call against the Pretix endpoints

Parameters:
  • api_call (str) – Specify the API call endpoint

  • method (RequestsMethods) – Specify the used method (default GET)

  • json_complete (str) – Specify the inserted JSON as string

  • org_id_header (int) – Specify the optional organization id as header for the corresponding API call

  • disable_provenance_header (bool) – Specify the optional disable provenance as header for the corresponding API call (default False)

  • response_status_code (bool) – Specify if the response should include the original status code (default False)

Raises:

Exception – Unspecified error by executing the API call

Returns:

Returns the value of the api call

Return type:

api_call (any)

create_the_http_api_client(headers: dict = None) Client | AsyncClient[source]

The method includes a functionality to create the corresponding HTTP client

Parameters:

headers (dict) – Specify the optional inserted headers (Default None)

Returns:

Returns the corresponding client

Return type:

client (Union[httpx.Client, httpx.AsyncClient])

static prepare_api_string(query_string: str) str[source]

The method includes a functionality to prepare the api string for the queries

Parameters:

query_string (str) – Specify the corresponding query string

Returns:

Returns the adjusted query string

Return type:

query_string (str)