0

Linkedin Documents are confusing like crazy. I just want to get some basic information. I need to get a company's recent updates, comments for the update, and how many likes the update got. I tried to follow the documentation and this is my code:

from linkedin import linkedin
import oauth2 as oauth
import httplib2

api_key = '9puxXXXXXXX'
secret_key = 'brtXoXEkXXXXXXXXX'
auth_token = '75e15760-XXXXXXXXXXXXXXXXXXXXXX'
auth_secret = '10d8caXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
RETURN_URL = 'http://localhost:8000'

cos = oauth.Consumer(api_key,secret_key)

access_token = oauth.Token(key=auth_token, secret=auth_secret)

client = oauth.Client(cos,access_token)

resp,content = client.request("http://api.linkedin.com/v1/companies/1219692/updates?start=0&count=10", "GET", "")

This code is supposed to get the 10 recent updates for apple, but this is what I get when I

print resp
print content


{'status': '200', 'content-length': '78', 'content-location': u'http://api.linkedin.com/v1/companies/216984/updates?count=10&oauth_body_hash=2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D&oauth_nonce=87365476&oauth_timestamp=1372347259&oauth_consumer_key=9puxXXXXXXX&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&start=0&oauth_token=75e1576XXXXXXX&oauth_signature=EhcMiQXXXXXXX%3D', 'transfer-encoding': 'chunked', 'vary': '*', 'server': 'Apache-Coyote/1.1', 'connection': 'close', '-content-encoding': 'gzip', 'date': 'Thu, 27 Jun 2013 15:34:18 GMT', 'x-li-request-id': '84BXIU5ZQK', 'x-li-format': 'xml', 'content-type': 'text/xml;charset=UTF-8'}

what am I doing wrong?

1 Answer 1

2

Your code does not make sense, you imported linkedin module, which seems to be this module, but I can't see you are using that API wrapper in your code. If I'm wrong you can still use the wrapper above and easily handle data back from LinkedIn. Just take a look at this example:

Querying updates

sample:

from linkedin import server

application = server.quick_api(KEY, SECRET)
application.get_company_updates(1035, params={'count': 2})

where 1035 is the ID of the company you are trying to get updates from.

Sign up to request clarification or add additional context in comments.

2 Comments

When I just do the first line in your code: from linkedin import server, i get an error: ImportError: No module named oauthlib.common i googled it, but could not find any solutions
Yes well, if you read the linkedin python module documentation, you need a couple of modules:$ pip install python-linkedin $ pip install requests $ pip install requests_oauthlib

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.