Skip to content

Exceptions

Exception Hierachy

CTFdpyException

Bases: Exception

Base exception for CTFdpy

Source code in ctfdpy\exceptions.py
26
27
28
29
30
31
class CTFdpyException(Exception):
    """
    Base exception for CTFdpy
    """

    pass

RequestTimeout

Bases: CTFdpyException

Exception raised when a request times out

Source code in ctfdpy\exceptions.py
34
35
36
37
38
39
40
41
class RequestTimeout(CTFdpyException):
    """
    Exception raised when a request times out
    """

    def __init__(self, *args, request: dict[str, Request] | None = None):
        self.request = request
        super().__init__(*args)

AuthenticationError

Bases: CTFdpyException

Exception raised when a user is not authenticated

Source code in ctfdpy\exceptions.py
44
45
46
47
class AuthenticationError(CTFdpyException):
    """
    Exception raised when a user is not authenticated
    """

APIResponseException

Bases: CTFdpyException

Exception raised when a request to the CTFd API fails

Source code in ctfdpy\exceptions.py
50
51
52
53
54
55
56
57
class APIResponseException(CTFdpyException):
    """
    Exception raised when a request to the CTFd API fails
    """

    def __init__(self, *args, response: Response | None = None):
        self.response = response
        super().__init__(*args)

BadRequest

Bases: APIResponseException

Exception raised when a request returns a 400

Source code in ctfdpy\exceptions.py
60
61
62
63
64
65
class BadRequest(APIResponseException):
    """
    Exception raised when a request returns a 400
    """

    pass

Unauthorized

Bases: APIResponseException

Exception raised when a request returns a 401

Source code in ctfdpy\exceptions.py
68
69
70
71
72
73
class Unauthorized(APIResponseException):
    """
    Exception raised when a request returns a 401
    """

    pass

Forbidden

Bases: APIResponseException

Exception raised when a request returns a 403

Source code in ctfdpy\exceptions.py
76
77
78
79
80
81
class Forbidden(APIResponseException):
    """
    Exception raised when a request returns a 403
    """

    pass

NotFound

Bases: APIResponseException

Exception raised when a request returns a 404

Source code in ctfdpy\exceptions.py
84
85
86
87
88
89
class NotFound(APIResponseException):
    """
    Exception raised when a request returns a 404
    """

    pass

AdminOnly

Bases: APIResponseException

Exception raised when a request requires the user to be an admin

Source code in ctfdpy\exceptions.py
92
93
94
95
96
97
class AdminOnly(APIResponseException):
    """
    Exception raised when a request requires the user to be an admin
    """

    pass

UnsuccessfulResponse

Bases: APIResponseException

Exception raised when the response is not successful

Source code in ctfdpy\exceptions.py
100
101
102
103
104
105
class UnsuccessfulResponse(APIResponseException):
    """
    Exception raised when the response is not successful
    """

    pass

BadChallengeAttempt

Bases: APIResponseException

Exception raised when a challenge attempt returns a non200 response

Source code in ctfdpy\exceptions.py
108
109
110
111
112
113
class BadChallengeAttempt(APIResponseException):
    """
    Exception raised when a challenge attempt returns a non200 response
    """

    pass

ModelValidationError

Bases: CTFdpyException

Exception raised when a model fails validation

Source code in ctfdpy\exceptions.py
116
117
118
119
120
121
class ModelValidationError(CTFdpyException):
    """
    Exception raised when a model fails validation
    """

    pass