Skip to content

Commit

Permalink
Handling error
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhan Ahmed committed Jul 19, 2023
1 parent c34f750 commit a521b4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions GoogleAds/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
author_email="[email protected]",
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=[
Expand Down

0 comments on commit a521b4f

Please sign in to comment.