现在我尝试使用linkedin python api来获取用户信息,下面是我的代码:
from linkedin import linkedin
API_Key='...'
API_Secret='...'
Return_url='http://localhost:8000'
authentication = linkedin.LinkedInAuthentication(API_Key, API_Secret, Return_url, linkedin.PERMISSIONS.enums.values())
print(authentication.authorization_url) # open this url on your browser
application = linkedin.LinkedInApplication(authentication)
application.get_profile()
但是,它显示错误:
AttributeError: 'NoneType' object has no attribute 'access_token'
还有一个问题是,如果我有一个人的名字,如何使用api来获取这个人的信息?
最佳答案
没有代表发表评论,但请参阅此答案:Python: Attribute Error - 'NoneType' object has no attribute 'something'
这相当于java中的空指针异常。无论您尝试访问“access_token”字段的对象是什么,它都是空的。如果该对象是函数调用返回的对象,则该函数调用可能失败。
关于python - python linkedinapi 出现 "NoneType"对象没有属性错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46823597/