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

Exception in get company method

Open bevenky opened this issue 4 years ago • 4 comments

File "test.py", line 7, in company = api.get_company('microsoft.com') File "/Users/linkedinapi_env/lib/pythonX.X/site-packages/linkedin_api/linkedin.py", line 481, in get_company self.logger.info("request failed: {}".format(data["message"])) KeyError: 'message'

bevenky avatar Oct 26 '19 22:10 bevenky

+1 same issue here. Searching for fiverr.

naiktanmai avatar Mar 11 '20 06:03 naiktanmai

Similar issue here :

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 parameter in this case

ghost avatar Jun 23 '20 19:06 ghost

+1 bug...

jeremy1392 avatar Aug 14 '20 18:08 jeremy1392

Error happens because you need to transform companyName value with blank which could be "Bla Bla" into "Bla-Bla" You can fixe it by doing:

get_company(companyName.replace(" ", "-"))

jeremy1392 avatar Aug 14 '20 19:08 jeremy1392