potiuk commented on code in PR #28838: URL: https://github.com/apache/airflow/pull/28838#discussion_r1066360473
########## docs/exts/docs_build/fetch_inventories.py: ########## @@ -47,25 +49,41 @@ def _fetch_file(session: requests.Session, package_name: str, url: str, path: str) -> tuple[str, bool]: """ - Download a file and returns status information as a tuple with package + Download a file, validate Sphinx Inventory headers and returns status information as a tuple with package name and success status(bool value). """ try: response = session.get(url, allow_redirects=True, stream=True) except (requests.RequestException, urllib3.exceptions.HTTPError): - print(f"Failed to fetch inventory: {url}") + print(f"{package_name}: Failed to fetch inventory: {url}") traceback.print_exc(file=sys.stderr) return package_name, False if not response.ok: - print(f"Failed to fetch inventory: {url}") - print(f"Failed with status: {response.status_code}", file=sys.stderr) + print(f"{package_name}: Failed to fetch inventory: {url}") + print(f"{package_name}: Failed with status: {response.status_code}", file=sys.stderr) return package_name, False - os.makedirs(os.path.dirname(path), exist_ok=True) - with open(path, "wb") as f: - response.raw.decode_content = True - shutil.copyfileobj(response.raw, f) - print(f"Fetched inventory: {url}") + if response.url != url: + print(f"{package_name}: {url} redirected to {response.url}") Review Comment: NICE! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org