Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyword name issue #527

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alicanyuksel
Copy link

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant