linkedin-api icon indicating copy to clipboard operation
linkedin-api copied to clipboard

`search` encoding error on the `keywords` query string parameter

Open ghost opened this issue 5 years ago • 1 comments

There's an issue with encoding in the search method. I found the bug using the search_companies method but I guess it's the same for other searches

result = api.search_companies(
     keywords="CHEERLY, LET'S PARTY !",
     limit=2
)

throws the following error :

[...]
"linkedin.py", line 102, in search
    for i in range(len(data["data"]["elements"])):
KeyError: 'data'

I think the error comes from the comma in keywords not being properly encoded

f"/search/blended?{urlencode(default_params, safe='(),')}" the , is not safe for the keywords query string parameter in this case

ghost avatar Jun 23 '20 20:06 ghost

I think the encoding could get done prior to making the filters string here : params = {"filters": "List({})".format(",".join(filters))} so that there's no issue if there's a comma within the filters list already ?

ghost avatar Jun 24 '20 11:06 ghost