From ebc6ae78c1f535dee3618e41e6a0f926cedae57b Mon Sep 17 00:00:00 2001 From: Vi6hal <20889199+Vi6hal@users.noreply.github.com> Date: Thu, 18 Apr 2024 05:12:55 +0000 Subject: [PATCH] fixes pagination implementation --- CHANGELOG.md | 5 ++++- setup.py | 2 +- tap_linkedin_ads/streams.py | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c96e6..bf24bdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.3.1 + * Fixes url encoding issue with `video_ads` stream pagination + ## 2.3.0 ### Features @@ -49,7 +52,7 @@ ## 1.2.5 * Auto access-token refresh [#41](https://github.com/singer-io/tap-linkedin-ads/pull/41) - + ## 1.2.4 * Add Request Timeout [#36](https://github.com/singer-io/tap-linkedin-ads/pull/36) * Handling 4xx responses for adCampaignGroup [#28](https://github.com/singer-io/tap-linkedin-ads/pull/28) diff --git a/setup.py b/setup.py index 0e8f9e1..1e71c04 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup(name='tap-linkedin-ads', - version='2.3.0', + version='2.3.1', description='Singer.io tap for extracting data from the LinkedIn Marketing Ads API API 2.0', author='jeff.huth@bytecode.io', classifiers=['Programming Language :: Python :: 3 :: Only'], diff --git a/tap_linkedin_ads/streams.py b/tap_linkedin_ads/streams.py index e8e5799..0a08620 100644 --- a/tap_linkedin_ads/streams.py +++ b/tap_linkedin_ads/streams.py @@ -108,7 +108,7 @@ def get_next_url(stream_name, next_url, data): if href: # url must be kept encoded for the creatives endpoint. # Ref - https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-creatives?view=li-lms-2023-01&tabs=http#sample-request-3 - if "rest/creatives" in href: + if "rest/creatives" in href or "rest/posts" in href: return 'https://api.linkedin.com{}'.format(href) # Prepare next page URL next_url = 'https://api.linkedin.com{}'.format(urllib.parse.unquote(href)) @@ -617,7 +617,8 @@ class VideoAds(LinkedInAds): parent = "accounts" params = { "q": "dscAdAccount", - "dscAdTypes": "List(VIDEO)" + "dscAdTypes": "List(VIDEO)", + "count":100 } headers = {'X-Restli-Protocol-Version': "2.0.0"}