PyFlowery/pyflowery/exceptions.py
cswimr 33b63fecc4
Some checks failed
Actions / lint (push) Failing after 16s
Actions / build (push) Successful in 19s
(1.0.3) retry handlers and more
added automatic retry handlers for 429 and 5xx error codes, as well as custom exceptions for ratelimiting, client errors, and server errors
also added a more advanced user agent string constructor. previously, setting FloweryAPIConfig.user_agent would override the default user_agent. so, if you set user_agent to `foobar`, the user agent string would be `foobar` in requests. now, the user agent string sent by requests would be the following on my development machine:
`'User-Agent': 'PyFlowery/1.0.3 PyFloweryTests (Python 3.12.6 (main, Sep  8 2024, 13:18:56) [GCC 14.2.1 20240805])'`
2024-09-17 23:24:14 -04:00

19 lines
621 B
Python

class InternalServerError(Exception):
def __init__(self, message):
self.message = message
super(InternalServerError, self).__init__(message)
class ClientError(Exception):
def __init__(self, message):
self.message = message
super(ClientError, self).__init__(message)
class TooManyRequests(Exception):
def __init__(self, message):
self.message = message
super(TooManyRequests, self).__init__(message)
class RetryLimitExceeded(Exception):
def __init__(self, message):
self.message = message
super(RetryLimitExceeded, self).__init__(message)