@@ -13,27 +13,31 @@ command line interactive example below.
1313 >>> client_id = '<the id you get from linkedin>'
1414 >>> client_secret = '<the secret you get from linkedin>'
1515
16+ >>> # LinkedIn OAuth2 requests require scope and redirect_url parameters.
17+ >>> # Ensure these values match the auth values in your LinkedIn App
18+ >>> # (see auth tab on LinkedIn Developer page)
19+ >>> scope = ['r_liteprofile']
20+ >>> redirect_url = 'http://127.0.0.1'
21+
1622 >>> # OAuth endpoints given in the LinkedIn API documentation
17- >>> authorization_base_url = 'https://www.linkedin.com/uas/oauth2 /authorization'
18- >>> token_url = 'https://www.linkedin.com/uas/oauth2 /accessToken'
23+ >>> authorization_base_url = 'https://www.linkedin.com/oauth/v2 /authorization'
24+ >>> token_url = 'https://www.linkedin.com/oauth/v2 /accessToken'
1925
2026 >>> from requests_oauthlib import OAuth2Session
21- >>> from requests_oauthlib.compliance_fixes import linkedin_compliance_fix
2227
2328 >>> linkedin = OAuth2Session(client_id, redirect_uri='http://127.0.0.1')
24- >>> linkedin = linkedin_compliance_fix(linkedin)
2529
2630 >>> # Redirect user to LinkedIn for authorization
2731 >>> authorization_url, state = linkedin.authorization_url(authorization_base_url)
28- >>> print ' Please go here and authorize,', authorization_url
32+ >>> print(" Please go here and authorize, {}").format( authorization_url))
2933
3034 >>> # Get the authorization verifier code from the callback url
31- >>> redirect_response = raw_input ('Paste the full redirect URL here:')
35+ >>> redirect_response = input ('Paste the full redirect URL here:')
3236
3337 >>> # Fetch the access token
34- >>> linkedin.fetch_token(token_url, client_secret=client_secret,
35- ... authorization_response=redirect_response)
38+ >>> linkedin.fetch_token(token_url,client_secret=client_secret,
39+ ... include_client_id=True, authorization_response=redirect_response)
3640
3741 >>> # Fetch a protected resource, i.e. user profile
38- >>> r = linkedin.get('https://api.linkedin.com/v1/people/~ ')
39- >>> print r.content
42+ >>> r = linkedin.get('https://api.linkedin.com/v2/me ')
43+ >>> print( r.content)
0 commit comments