tomquirk / linkedin-api

👨‍💼 LinkedIn API for Python
https://pypi.org/project/linkedin-api
MIT License
2.11k stars 452 forks source link

Exception in get company method #75

Closed bevenky closed 2 months ago

bevenky commented 5 years ago

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'

naiktanmai commented 4 years ago

+1 same issue here. Searching for fiverr.

ghost commented 4 years ago

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

jeremy1392 commented 4 years ago

+1 bug...

jeremy1392 commented 4 years ago

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(" ", "-"))

tomquirk commented 2 months ago

Gotta pass in the company's "public id". You can get it from the URL when viewing the company

Screenshot 2024-09-02 at 8 47 11 PM