(1.0.4) pylint fixes
All checks were successful
Actions / build (push) Successful in 21s
Actions / lint (push) Successful in 18s

This commit is contained in:
Seaswimmer 2024-09-17 23:31:50 -04:00
parent 33b63fecc4
commit 7b0b13604b
Signed by: cswimr
GPG key ID: 3813315477F26F82
4 changed files with 8 additions and 10 deletions

View file

@ -1,19 +1,19 @@
class InternalServerError(Exception):
"""Raised when the API returns a 5xx status code"""
def __init__(self, message):
self.message = message
super(InternalServerError, self).__init__(message)
class ClientError(Exception):
"""Raised when the API returns a 4xx status code"""
def __init__(self, message):
self.message = message
super(ClientError, self).__init__(message)
class TooManyRequests(Exception):
"""Raised when the API returns a 429 status code"""
def __init__(self, message):
self.message = message
super(TooManyRequests, self).__init__(message)
class RetryLimitExceeded(Exception):
"""Raised when the retry limit is exceeded"""
def __init__(self, message):
self.message = message
super(RetryLimitExceeded, self).__init__(message)

View file

@ -64,12 +64,10 @@ class RestAdapter:
try:
if result.status_code == 429:
raise TooManyRequests(f"{result.message} - {result.data}")
elif 400 <= result.status_code < 500:
if 400 <= result.status_code < 500:
raise ClientError(f"{result.status_code} - {result.message} - {result.data}")
elif 500 <= result.status_code < 600:
if 500 <= result.status_code < 600:
raise InternalServerError(f"{result.status_code} - {result.message} - {result.data}")
else:
pass
except (TooManyRequests, InternalServerError) as e:
if retry_counter < self.config.retry_limit:
interval = self.config.interval * retry_counter

View file

@ -1 +1 @@
VERSION = "1.0.3"
VERSION = "1.0.4"

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyflowery"
version = "1.0.3"
version = "1.0.4"
description = "A Python API wrapper for the Flowery API"
authors = ["cswimr <seaswimmerthefsh@gmail.com>"]
license = "GPL 3.0-only"