2017-10-19 4 views
1

Maintenant, je suis en train d'utiliser api python linkedin pour obtenir les informations des utilisateurs, ci-dessous est mon code:« NoneType » L'objet n'a pas d'erreur d'attribut en python linkedinapi

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() 

Cependant, montrent l'erreur:

AttributeError: 'NoneType' object has no attribute 'access_token'

Et un autre problème est, si j'ai un nom de la personne, comment utiliser api pour obtenir l'information de la personne?

Répondre

0

Ne pas avoir le représentant de commenter, mais voir cette réponse: Python: Attribute Error - 'NoneType' object has no attribute 'something'

Ceci est l'équivalent d'une exception de pointeur NULL en java. Quel que soit l'objet que vous essayez d'accéder au champ "access_token", il est nul. Si cet objet est ce qui est retourné à partir d'un appel de fonction, cet appel de fonction a peut-être échoué.

également voir Authenticate to linkedin

problems with LinkedIn API connection

Using oauth2_access_token to get connections in linkedIn

+0

Je ne sais pas quel est le problème avec mon programme – sweetyBaby

+0

Avez-vous étudié les liens que j'ai posté? – pellucidcoder