This commit is contained in:
@@ -27,6 +27,7 @@ MAPPING: Dict[str, str] = {
|
||||
"volume": "api/comics/volumes",
|
||||
"story_arc": "api/comics/storyarcs",
|
||||
"issue": "api/comics/issues",
|
||||
"comic_work": "api/comics/comicworks",
|
||||
"issue_work": "api/comics/issueworks",
|
||||
"article": "api/bookshelf/articles",
|
||||
"bookshelf_publisher": "api/bookshelf/publishers",
|
||||
@@ -46,13 +47,15 @@ MAPPING: Dict[str, str] = {
|
||||
"mail_account": "api/admin/mailaccounts",
|
||||
}
|
||||
|
||||
|
||||
class EndPointNotAvailableException(Exception):
|
||||
"""
|
||||
Raised when calling an not existing endpoint.
|
||||
"""
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Login:
|
||||
"""
|
||||
@@ -106,7 +109,7 @@ class Server:
|
||||
headers: Dict[str, str] = {"Authorization": f"Bearer {self.token}"}
|
||||
response = requests.get(url, headers=headers, timeout=self.timeout)
|
||||
log.debug(f"Status: {response.status_code}")
|
||||
if response.status_code==404:
|
||||
if response.status_code == 404:
|
||||
raise EndPointNotAvailableException
|
||||
data = response.json()
|
||||
return data
|
||||
@@ -129,16 +132,14 @@ class ApiConfig:
|
||||
|
||||
login: Login
|
||||
server: List[Server]
|
||||
|
||||
|
||||
def get_server(self, server_name: str) -> Optional[Server]:
|
||||
"""
|
||||
"""
|
||||
""" """
|
||||
found_server = None
|
||||
for server in self.server:
|
||||
if server.name == server_name:
|
||||
found_server = server
|
||||
return found_server
|
||||
|
||||
|
||||
|
||||
def get_logger(level, config: str):
|
||||
|
||||
Reference in New Issue
Block a user