Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 6, 2024
1 parent 8b42f28 commit e1a9595
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dcoraid/api/ckan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import pathlib
import traceback
from typing import Any, Dict
import numbers

from dclab.external.packaging import parse as parse_version
import requests
Expand Down Expand Up @@ -37,7 +37,7 @@ def __init__(self,
api_key: str | None = "",
ssl_verify: bool = True,
check_ckan_version: bool = True,
caching: bool = True):
caching: bool | str | pathlib.Path = True):
"""User-convenient interface to the CKAN API
Parameters
Expand Down Expand Up @@ -259,7 +259,7 @@ def is_available(self, with_api_key=False, with_correct_version=False):
status = True
return status

def get(self, api_call: str, **kwargs: Dict[Any]):
def get(self, api_call: str, **kwargs: str | numbers.Number):
"""GET request
Parameters
Expand Down
8 changes: 8 additions & 0 deletions dcoraid/api/errors.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
class APIError(BaseException):
"""General CKANAPI error"""
pass


class APIAuthorizationError(APIError):
"""User credentials are invalid"""
pass


class APIBadGatewayError(APIError):
"""Cannot connect to DCOR server"""
pass


class APIConflictError(APIError):
"""Invalid payload to DCOR server"""
pass


class APIGatewayTimeoutError(APIError):
"""Timeout due to network connection"""
pass


class APINotFoundError(APIError):
"""Requested object not found on DCOR"""
pass


class APIOutdatedError(APIError):
"""DCOR-Aid is outdated, the server requests a newer version"""
pass


class NoAPIKeyError(APIError):
"""DCOR does not have an API key"""
pass

0 comments on commit e1a9595

Please sign in to comment.