def convert(source, crossrefQuery='', token=''): global application if token == '': authentication = LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, PERMISSIONS.enums.values()) authorization_url = authentication.authorization_url authorization_url = authorization_url.replace( '%20r_fullprofile', '').replace('%20rw_groups', '').replace( '%20w_messages', '').replace('%20r_contactinfo', '').replace( '%20r_network', '%20rw_company_admin').replace('%20rw_nus', '%20w_share') #print authorization_url cmd = 'open "' + authorization_url + '"' print cmd msg = subprocess.check_output(cmd, shell=True) else: authentication = LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, PERMISSIONS.enums.values()) authentication.authorization_code = token access_token = authentication.get_access_token() print access_token[0] application = LinkedInApplication(authentication=authentication, token=access_token[0]) if application != None: #print application.get_profile() #response = application.make_request('GET', 'https://api.linkedin.com/v1/people/~') #response = application.make_request('GET', 'https://api.linkedin.com/v1/companies::(universal-name=dog)') #https://stackoverflow.com/questions/30409219/linkedin-api-unable-to-view-any-company-profile response = application.get_companies(universal_names='naughty dog') print str(response) return ''
from linkedin.linkedin import (LinkedInAuthentication, LinkedInApplication, PERMISSIONS) if __name__ == '__main__': API_KEY = '75q0rlkmhlgpa2' API_SECRET = 'MT0Dr4xxlbpUDC5e' RETURN_URL = 'http://localhost:8000' authentication = LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, PERMISSIONS.enums.values()) print authentication.authorization_url application = LinkedInApplication(authentication) application.get_companies(company_ids=[1035], universal_names=['apple'], selectors=['name'], params={'is-company-admin': 'true'})
from linkedin.linkedin import (LinkedInAuthentication, LinkedInApplication, PERMISSIONS) if __name__ == '__main__': API_KEY = '75q0rlkmhlgpa2' API_SECRET = 'MT0Dr4xxlbpUDC5e' RETURN_URL = 'http://localhost:8000' authentication = LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, PERMISSIONS.enums.values()) print authentication.authorization_url application = LinkedInApplication(authentication) application.get_companies(company_ids=[1035], universal_names=['apple'], selectors=['name'], params={'is-company-admin': 'true'})