linkedin-api
linkedin-api copied to clipboard
`search` encoding error on the `keywords` query string parameter
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
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 ?