bellingcat / wayback-google-analytics

A lightweight tool for scraping current and historic Google Analytics data
https://pypi.org/project/wayback-google-analytics/
MIT License
192 stars 23 forks source link

bug: KeyError: 'current_UA_code' #17

Closed msramalho closed 1 year ago

msramalho commented 1 year ago
wayback_google_analytics/output.py", line 101, in get_urls_df
    "UA_Code": info["current_UA_code"],
KeyError: 'current_UA_code'

This is due, I believe, to this code section where the keys are assigned, but only if the html variable is not None.

One simple solution is to do dict.get instead of dict[] for the optionally present parameters, eg: info.get("current_UA_code", ""), but I wonder if there's some missing logic between the 2 different parts and if there's a better way to address it.

jclark1913 commented 1 year ago

Resolved in PR #18.