@@ -9,41 +9,31 @@ command line interactive example below.
99
1010.. code-block :: pycon
1111
12- >>> # Imports
13- >>> import os
14- >>> from requests_oauthlib import OAuth2Session
15-
16- >>> # Set environment variables
17- >>> os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
18-
1912 >>> # Credentials you get from registering a new application
2013 >>> client_id = '<the id you get from linkedin>'
2114 >>> client_secret = '<the secret you get from linkedin>'
2215
23- >>> # LinkedIn OAuth2 requests require scope and redirect_url parameters.
24- >>> # Ensure these values match the auth values in your LinkedIn App
25- >>> # (see auth tab on LinkedIn Developer page)
26- >>> scope = ['r_liteprofile']
27- >>> redirect_url = 'http://127.0.0.1'
28-
2916 >>> # OAuth endpoints given in the LinkedIn API documentation
30- >>> authorization_base_url = 'https://www.linkedin.com/oauth/v2/authorization'
31- >>> token_url = 'https://www.linkedin.com/oauth/v2/accessToken'
17+ >>> authorization_base_url = 'https://www.linkedin.com/uas/oauth2/authorization'
18+ >>> token_url = 'https://www.linkedin.com/uas/oauth2/accessToken'
19+
20+ >>> from requests_oauthlib import OAuth2Session
21+ >>> from requests_oauthlib.compliance_fixes import linkedin_compliance_fix
3222
33- >>> linkedin = OAuth2Session(client_id, redirect_uri='http://127.0.0.1', scope=scope)
23+ >>> linkedin = OAuth2Session(client_id, redirect_uri='http://127.0.0.1')
24+ >>> linkedin = linkedin_compliance_fix(linkedin)
3425
3526 >>> # Redirect user to LinkedIn for authorization
3627 >>> authorization_url, state = linkedin.authorization_url(authorization_base_url)
37- >>> print(f" Please go here and authorize: { authorization_url}")
28+ >>> print ' Please go here and authorize,', authorization_url
3829
3930 >>> # Get the authorization verifier code from the callback url
40- >>> redirect_response = input ('Paste the full redirect URL here:')
31+ >>> redirect_response = raw_input ('Paste the full redirect URL here:')
4132
4233 >>> # Fetch the access token
4334 >>> linkedin.fetch_token(token_url, client_secret=client_secret,
44- ... include_client_id=True,
4535 ... authorization_response=redirect_response)
4636
4737 >>> # Fetch a protected resource, i.e. user profile
48- >>> r = linkedin.get('https://api.linkedin.com/v2/me ')
49- >>> print( r.content)
38+ >>> r = linkedin.get('https://api.linkedin.com/v1/people/~ ')
39+ >>> print r.content
0 commit comments