python-linkedin:动态使用

时间:2016-10-17 16:42:26

标签: python linkedin-api

我想刮掉LinkedIn,主要是找到有关人的基本信息。 我正在尝试使用LinkedIn api,python-linkedin。 似乎我错过了一些东西。如果我想获取我的个人资料,那么我需要:

from linkedin import linkedin

KEY = "XXXX"
SECRET = "XXXX"
RETURN_URL = 'http://localhost:8000'

PERMISSIONS = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share']
authentication = linkedin.LinkedInAuthentication(KEY, SECRET, RETURN_URL, PERMISSIONS)

# Open the link manually.  
print(authentication.authorization_url)

# And copy from the redirected url.
authentication.authorization_code = 'XXXX' 
access_token = authentication.get_access_token()
application = linkedin.LinkedInApplication(authentication)
print(application.get_profile())

这种方式非常硬编码和静态。我怎么能这样但动态地做?

0 个答案:

没有答案