Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Fix keyword name issue - #527

Open
Alican Yüksel (alicanyuksel) wants to merge 1 commit into
GeneralMills:masterfrom
alicanyuksel:fix-keyerror-issue
Open

Fix keyword name issue#527
Alican Yüksel (alicanyuksel) wants to merge 1 commit into
GeneralMills:masterfrom
alicanyuksel:fix-keyerror-issue

Conversation

@alicanyuksel

Copy link
Copy Markdown

Hello,

It is possible to observe compound keywords in the same keyword on Google Trends like 'blockchain + bitcoin'. Your try except block only takes the first element of the list. That's why, in the dictionary that the function returns, we only find "blockchain" as a key but not the real keyword which is "blockchain + bitcoin".

API response example for a given multi keyword:
[{'type': 'BROAD', 'value': 'blockchain'}, {'type': 'BROAD', 'value': 'bitcoin'}]

If you don't want to use keywordName attribute in PR, here is my second suggestion:

try:
    kw = " + ".join(
        each_kw_dict["value"]
        for each_kw_dict in request_json["request"]["restriction"]["complexKeywordsRestriction"][
            "keyword"
        ]
    )
except KeyError:
    kw = ""

I work a lot on this kind of keywords, hoping that it will be merged.
Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant