From 242e4adf80ec32e3798b5474d3138ea7d6c91004 Mon Sep 17 00:00:00 2001 From: Marc-Philipp Esser Date: Sun, 8 Oct 2023 14:30:27 +0200 Subject: [PATCH] use request_unsplash_api to request backend api (napi) --- src/prefect/ingest_photos_napi_gcs.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/prefect/ingest_photos_napi_gcs.py b/src/prefect/ingest_photos_napi_gcs.py index 06ab366..7b0d216 100644 --- a/src/prefect/ingest_photos_napi_gcs.py +++ b/src/prefect/ingest_photos_napi_gcs.py @@ -21,9 +21,8 @@ parse_response, prepare_proxy_adresses, request_unsplash_api, - request_unsplash_napi, ) -from src.utils import load_env_variables, timer +from src.utils import load_env_variables @flow(retries=3, retry_delay_seconds=10) # Subflow (2nd level) @@ -79,7 +78,6 @@ def _upload_photo_metadata_as_blob( timeout_seconds=120, task_runner=ConcurrentTaskRunner(), ) # Subflow (2nd level) -@timer def upload_photo_metadata_to_gcs( response, response_json: list[dict], @@ -199,7 +197,6 @@ def write_request_log_to_bigquery( @flow # Main Flow (1st level) -@timer def ingest_photos_napi_gcs( gcp_credential_block_name: str, per_page: int, @@ -258,7 +255,13 @@ def ingest_photos_napi_gcs( # Actually request the data logger.info("Request data of interest") - response = request_unsplash_napi("/photos", proxies, headers, params) + response = request_unsplash_api( + endpoint="/photos", + proxies=proxies, + headers=headers, + params=params, + base_url="https://unsplash.com/napi", + ) logger.info(f"Request headers: \n {pformat(dict(response.request.headers))}") logger.info(f"Response headers: \n {pformat(dict(response.headers))}")