From c97ba6549484ca00ab8af10750e1a05d5f3ac919 Mon Sep 17 00:00:00 2001 From: Prratek Ramchandani Date: Wed, 23 Feb 2022 12:18:03 -0500 Subject: [PATCH 1/2] pass media_product_type in parent context --- tap_instagram/streams.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index 6c96665..9d820b7 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -197,6 +197,7 @@ def get_child_context(self, record: dict, context: Optional[dict]) -> dict: "user_id": context["user_id"], "media_id": record["id"], "media_type": record["media_type"], + "media_product_type": record["media_product_type"], } @@ -347,7 +348,7 @@ def get_url_params( self, context: Optional[dict], next_page_token: Optional[Any] ) -> Dict[str, Any]: params = super().get_url_params(context, next_page_token) - params["metric"] = self._metrics_for_media_type(context["media_type"]) + params["metric"] = self._metrics_for_media_type(context["media_type"], context["media_product_type"]) return params def validate_response(self, response: requests.Response) -> None: From 19f2302a3e9fe33f0039b790173468230b0e095f Mon Sep 17 00:00:00 2001 From: Prratek Ramchandani Date: Wed, 23 Feb 2022 12:18:48 -0500 Subject: [PATCH 2/2] linting and formatting --- tap_instagram/client.py | 1 - tap_instagram/streams.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tap_instagram/client.py b/tap_instagram/client.py index 7578e4b..835ad13 100644 --- a/tap_instagram/client.py +++ b/tap_instagram/client.py @@ -78,4 +78,3 @@ def validate_response(self, response: requests.Response) -> None: f"{response.reason} for path: {self.path}" ) raise RetriableAPIError(msg) - diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index 9d820b7..3eafa32 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -348,7 +348,9 @@ def get_url_params( self, context: Optional[dict], next_page_token: Optional[Any] ) -> Dict[str, Any]: params = super().get_url_params(context, next_page_token) - params["metric"] = self._metrics_for_media_type(context["media_type"], context["media_product_type"]) + params["metric"] = self._metrics_for_media_type( + context["media_type"], context["media_product_type"] + ) return params def validate_response(self, response: requests.Response) -> None: