mirror of
https://github.com/Eledio/superfaktura-client.git
synced 2025-11-01 00:18:25 +01:00
fixes after rebase
This commit is contained in:
@@ -39,7 +39,6 @@ class SuperFakturaAPIException(Exception):
|
||||
"""Exception for errors when working with the SuperFaktura API."""
|
||||
|
||||
|
||||
|
||||
class SuperFakturaAPIMissingCredentialsException(Exception):
|
||||
"""Exception for missing login credentials."""
|
||||
|
||||
@@ -65,7 +64,9 @@ class SuperFakturaAPI:
|
||||
f"{_api_company_id}"
|
||||
}
|
||||
|
||||
def get(self, endpoint: str, data_format: DataFormat = DataFormat.JSON, timeout: int = 5) -> Dict:
|
||||
def get(
|
||||
self, endpoint: str, data_format: DataFormat = DataFormat.JSON, timeout: int = 5
|
||||
) -> Dict:
|
||||
"""
|
||||
Retrieves data from the SuperFaktura API.
|
||||
|
||||
@@ -97,10 +98,11 @@ class SuperFakturaAPI:
|
||||
return req.json()
|
||||
elif data_format == DataFormat.PDF:
|
||||
return {"pdf": req.content} # returns a dict with the PDF content
|
||||
else:
|
||||
raise SuperFakturaAPIException(
|
||||
f"Get status code: {req.status_code}; {req.json()}"
|
||||
)
|
||||
else:
|
||||
raise SuperFakturaAPIException("Invalid data format")
|
||||
raise SuperFakturaAPIException(
|
||||
f"Get status code: {req.status_code}; {req.json()}"
|
||||
)
|
||||
|
||||
def post(self, endpoint: str, data: str, timeout: int = 5) -> Dict:
|
||||
"""
|
||||
@@ -137,7 +139,6 @@ class SuperFakturaAPI:
|
||||
)
|
||||
if req.status_code == 200:
|
||||
return req.json()
|
||||
else:
|
||||
raise SuperFakturaAPIException(
|
||||
f"Post status code: {req.status_code}; {req.json()}"
|
||||
)
|
||||
raise SuperFakturaAPIException(
|
||||
f"Post status code: {req.status_code}; {req.json()}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user