@@ -0,0 +1,1686 @@
+from linkedin import linkedin%0Aimport oauthlib%0A%0Aclass Linkedinviewer (object):%0A%0A%09def __init__ (self, cred_file):%0A%09%09self.cred_file = cred_file%0A%09%09self.authentication = None%0A%09%09self.application = None%0A%0A%09def authenticate(self):%0A%0A%09%09# Define CONSUMER_KEY, CONSUMER_SECRET,  %0A%09%09# USER_TOKEN, and USER_SECRET from the credentials %0A%09%09# provided in your LinkedIn application%0A%0A%09%09cred_list = %5B%5D%0A%09%09with open(self.cred_file, 'r') as f:%0A%09%09%09cred_data = f.readlines()%0A%09%09%09for line in cred_data:%0A%09%09%09%09try:%0A%09%09%09%09%09cred_temp = line.split('=')%5B1%5D%0A%09%09%09%09except:%0A%09%09%09%09%09print %22Bad credentials for LinkedIn api authentication%22%0A%09%09%09%09cred_list.append(cred_temp.strip(' %5Ct%5Cn%5Cr'))%0A%0A%09%09# Authenticating with LinkedIn%0A%0A%09%09try:%0A%09%09%09self.authentication = linkedin.LinkedInDeveloperAuthentication(cred_list%5B0%5D, cred_list%5B1%5D, cred_list%5B2%5D,%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09cred_list%5B3%5D, cred_list%5B4%5D, linkedin.PERMISSIONS.enums.values())%0A%09%09%09self.application = application = linkedin.LinkedInApplication(self.authentication)%0A%09%09except:%0A%09%09%09print %22Failed to authenticate with LinkedIn%22%0A%0A%0A%09def get_profile(self):%0A%09%09%0A%09%09# Get profile information%0A%09%09profile = self.application.get_profile()%0A%09%09print profile%0A%0A%09def get_company(self, company_id=None, universal_names=%5B%5D):%0A%0A%09%09# Get company information%0A%09%09companies = self.application.get_companies(company_id, universal_names)%0A%09%09print companies%0A%0A%09def get_company_updates(self, company_id=None, count=1):%0A%0A%09%09# Get company updates%0A%09%09company_updates = self.application.get_company_updates(company_id, params=%7B'count': count%7D)%0A%09%09print company_updates%0A%0Aif __name__ == %22__main__%22:%0A%09lviewer = Linkedinviewer('linkedincred.conf')%0A%09lviewer.authenticate()%0A%09lviewer.get_profile()%0A%09lviewer.get_company(universal_names=%5B'splunk'%5D)

update linkedinviewer