phiture / searchads_api

Apple Search Ads API non-official python library
MIT License
49 stars 13 forks source link

You need to add exception handler for searchterm #3

Open HamoudAQ opened 4 years ago

HamoudAQ commented 4 years ago

I noticed that if I pass a campaign that is new then it would break, as this is the response from apple: {'data': {'reportingDataResponse': {'row': []}}, 'pagination': {'totalResults': 0, 'startIndex': 0, 'itemsPerPage': 0}, 'error': None} and obviously there's no grandTotals which is mentioned in the apy.py, line 1429 res["data"]["reportingDataResponse"]["grandTotals"])

a quick solution is to add try and except

elettradamaggio-gc commented 3 years ago

That's a good point I actually have the same issue. anyone coded a fix?

alkattan commented 3 years ago

Hi @HamoudAQ, Could you please create a pull request with the change you've asked for?