Skip to content

Commit

Permalink
Add specific user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
b-per committed May 21, 2024
1 parent a49cdee commit 9e1d256
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)
from src.schemas.job import JobDefinition


VERSION = "0.3.2"
class DBTCloud:
"""A minimalistic API client for fetching dbt Cloud data."""

Expand All @@ -31,6 +31,7 @@ def __init__(
self._headers = {
"Authorization": f"Bearer {self._api_key}",
"Content-Type": "application/json",
"User-Agent": f"dbt-jobs-as-code/v{VERSION}",
}
self._verify = not disable_ssl_verification
if not self._verify:
Expand Down Expand Up @@ -159,10 +160,7 @@ def get_job(self, job_id: int) -> JobDefinition:

response = requests.get(
url=(f"{self.base_url}/api/v2/accounts/" f"{self.account_id}/jobs/{job_id}"),
headers={
"Authorization": f"Bearer {self._api_key}",
"Content-Type": "application/json",
},
headers=self._headers,
verify=self._verify,
)
return JobDefinition(**response.json()["data"])
Expand Down Expand Up @@ -287,10 +285,7 @@ def get_environments(self) -> Dict:

response = requests.get(
url=(f"{self.base_url}/api/v3/accounts/" f"{self.account_id}/environments/"),
headers={
"Authorization": f"Bearer {self._api_key}",
"Content-Type": "application/json",
},
headers=self._headers,
verify=self._verify,
)

Expand Down

0 comments on commit 9e1d256

Please sign in to comment.