@@ -9,6 +9,13 @@ 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+
1219 >>> # Credentials you get from registering a new application
1320 >>> client_id = '<the id you get from linkedin>'
1421 >>> client_secret = '<the secret you get from linkedin>'
@@ -23,20 +30,17 @@ command line interactive example below.
2330 >>> authorization_base_url = 'https://www.linkedin.com/oauth/v2/authorization'
2431 >>> token_url = 'https://www.linkedin.com/oauth/v2/accessToken'
2532
26- >>> from requests_oauthlib import OAuth2Session
27-
28- >>> linkedin = OAuth2Session(client_id, redirect_uri='http://127.0.0.1')
33+ >>> linkedin = OAuth2Session(client_id, redirect_uri='http://127.0.0.1', scope=scope)
2934
3035 >>> # Redirect user to LinkedIn for authorization
3136 >>> authorization_url, state = linkedin.authorization_url(authorization_base_url)
32- >>> print("Please go here and authorize, {}") .format(authorization_url))
37+ >>> print("Please go here and authorize, {}".format(authorization_url))
3338
3439 >>> # Get the authorization verifier code from the callback url
3540 >>> redirect_response = input('Paste the full redirect URL here:')
3641
3742 >>> # Fetch the access token
38- >>> linkedin.fetch_token(token_url,client_secret=client_secret,
39- ... include_client_id=True,authorization_response=redirect_response)
43+ >>> linkedin.fetch_token(token_url,client_secret=client_secret,include_client_id=True,authorization_response=redirect_response)
4044
4145 >>> # Fetch a protected resource, i.e. user profile
4246 >>> r = linkedin.get('https://api.linkedin.com/v2/me')
0 commit comments