From a521b4f2a631cc2089061ef5005fcc4acdf69395 Mon Sep 17 00:00:00 2001 From: Farhan Ahmed Date: Wed, 19 Jul 2023 16:08:51 +0500 Subject: [PATCH] Handling error --- GoogleAds/main.py | 3 +-- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/GoogleAds/main.py b/GoogleAds/main.py index 6141091..cb9db73 100644 --- a/GoogleAds/main.py +++ b/GoogleAds/main.py @@ -80,7 +80,7 @@ def get_all_search_suggestions(self, keyword: str) -> list: params={'authuser': '0'}, data=data, ) - return suggestions if (suggestions := response.json()["1"]) else [] + return suggestions if (suggestions := response.json().get("1")) else [] def get_first_search_suggestion(self, keyword: str) -> Union[dict,None]: """ @@ -107,7 +107,6 @@ def get_advistisor_by_domain(self, domain: str) -> Union[dict,None]: if response := response.json().get("1"): ad = response[0] return {"Advertisor Id": ad["1"], "Name":ad["12"]} - return None #if ads := response.json().get("1"): # with open("new.json", "w") as f: # json.dump(ads, f) diff --git a/setup.py b/setup.py index 0a9978a..2a8a235 100644 --- a/setup.py +++ b/setup.py @@ -6,9 +6,9 @@ author_email="jattfarhan10@gmail.com", url="https://github.com/faniAhmed/GoogleAdsTransparencyScraper", description="A scraper for getting Ads from Google Ads Transparency", - version="1.5.7", + version="1.5.8", packages=find_packages(), - download_url= 'https://github.com/faniAhmed/GoogleAdsTransparencyScraper/archive/refs/tags/v1.5.7.tar.gz', + download_url= 'https://github.com/faniAhmed/GoogleAdsTransparencyScraper/archive/refs/tags/v1.5.8.tar.gz', keywords= ['Google', 'Transparency', 'Scraper', 'API', 'Google Ads', 'Ads', 'Google Transparency', 'Google Transparency Scraper', 'Google Ads Scraper'], license='Securely Incorporation', install_requires=[