Skip to content

Commit

Permalink
improve version handling, update User-Agent string
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Sep 23, 2024
1 parent f32b24e commit 593f5c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions airbyte/_executors/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from airbyte._util.telemetry import EventState, log_install_state # Non-public API
from airbyte.constants import TEMP_DIR_OVERRIDE
from airbyte.sources.registry import ConnectorMetadata, InstallType, get_connector_metadata
from airbyte.version import get_version


if TYPE_CHECKING:
Expand Down Expand Up @@ -51,12 +52,16 @@ def _try_get_source_manifest(

# If manifest URL was provided, we'll use the default URL from the public GCS bucket.

cleaned_version = (version or VERSION_LATEST).removeprefix("v")
manifest_url = manifest_url or DEFAULT_MANIFEST_URL.format(
source_name=source_name,
version=(version or VERSION_LATEST).removeprefix("v"),
version=cleaned_version,
)

response = requests.get(url=manifest_url)
response = requests.get(
url=manifest_url,
headers={"User-Agent": f"PyAirbyte/{get_version()}"},
)
response.raise_for_status() # Raise HTTPError exception if the download failed
try:
return cast(dict, yaml.safe_load(response.text))
Expand Down
3 changes: 2 additions & 1 deletion airbyte/sources/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ def _get_registry_cache(*, force_refresh: bool = False) -> dict[str, ConnectorMe
registry_url = _get_registry_url()
if registry_url.startswith("http"):
response = requests.get(
registry_url, headers={"User-Agent": f"airbyte-lib-{get_version()}"}
registry_url,
headers={"User-Agent": f"PyAirbyte/{get_version()}"},
)
response.raise_for_status()
data = response.json()
Expand Down

0 comments on commit 593f5c2

Please sign in to comment.