Skip to content

Commit

Permalink
Raise error if api_key or api_url is not present in the config
Browse files Browse the repository at this point in the history
  • Loading branch information
MartonVerhoczki committed Jun 27, 2024
1 parent 96a7406 commit 8ccef0f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tap_canvas_catalog/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class CanvasCatalogStream(RESTStream):
@property
def url_base(self) -> str:
"""Return the API URL root, configurable via tap settings."""
return self.config.get("api_url", "")
api_url = self.config.get("api_url", "")
if not api_url:
raise ValueError("api_url is not set in the configuration")
return api_url

records_jsonpath = "$[*]" # Or override `parse_response`.

Expand All @@ -36,6 +39,9 @@ def authenticator(self) -> APIKeyAuthenticator:
An authenticator instance.
"""
api_key = self.config.get("api_key", "")
if not api_key:
raise ValueError("api_key is not set in the configuration")

return APIKeyAuthenticator.create_for_stream(
self,
key="Authorization",
Expand Down

0 comments on commit 8ccef0f

Please sign in to comment.