diff --git a/AUTHORS.rst b/AUTHORS.rst index 62a07db..4f57959 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -25,3 +25,4 @@ Patches and Suggestions - Sylvain Marie - Craig Anderson - Hugo van Kemenade +- Jacques Troussard diff --git a/HISTORY.rst b/HISTORY.rst index 7039d23..5610533 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,8 +10,14 @@ v1.4.0 (TBD) is provided and ``scope`` is not overridden. Fixes `#408 `_ - Add support for Python 3.8-3.10 +- Remove Linkedin compliance fix. +v1.3.2 (20 February 2022) +++++++++++++++++++++++++ + +- Revert Linkined compliances fix, add deprecation warning. + v1.3.1 (21 January 2022) ++++++++++++++++++++++++ diff --git a/docs/examples/linkedin.rst b/docs/examples/linkedin.rst index a4009e4..2fd0d9c 100644 --- a/docs/examples/linkedin.rst +++ b/docs/examples/linkedin.rst @@ -13,9 +13,15 @@ command line interactive example below. >>> client_id = '' >>> client_secret = '' + >>> # LinkedIn OAuth2 requests require scope and redirect_url parameters. + >>> # Ensure these values match the auth values in your LinkedIn App + >>> # (see auth tab on LinkedIn Developer page) + >>> scope = ['r_liteprofile'] + >>> redirect_url = 'http://127.0.0.1' + >>> # OAuth endpoints given in the LinkedIn API documentation - >>> authorization_base_url = 'https://www.linkedin.com/uas/oauth2/authorization' - >>> token_url = 'https://www.linkedin.com/uas/oauth2/accessToken' + >>> authorization_base_url = 'https://www.linkedin.com/oauth/v2/authorization' + >>> token_url = 'https://www.linkedin.com/oauth/v2/accessToken' >>> from requests_oauthlib import OAuth2Session >>> from requests_oauthlib.compliance_fixes import linkedin_compliance_fix @@ -25,15 +31,16 @@ command line interactive example below. >>> # Redirect user to LinkedIn for authorization >>> authorization_url, state = linkedin.authorization_url(authorization_base_url) - >>> print 'Please go here and authorize,', authorization_url + >>> print(f'Please go here and authorize: {authorization_url}') >>> # Get the authorization verifier code from the callback url - >>> redirect_response = raw_input('Paste the full redirect URL here:') + >>> redirect_response = input('Paste the full redirect URL here:') >>> # Fetch the access token >>> linkedin.fetch_token(token_url, client_secret=client_secret, + ... include_client_id=True, ... authorization_response=redirect_response) >>> # Fetch a protected resource, i.e. user profile - >>> r = linkedin.get('https://api.linkedin.com/v1/people/~') - >>> print r.content + >>> r = linkedin.get('https://api.linkedin.com/v2/me') + >>> print(r.content) diff --git a/requests_oauthlib/compliance_fixes/linkedin.py b/requests_oauthlib/compliance_fixes/linkedin.py index cd5b4ac..acab2db 100644 --- a/requests_oauthlib/compliance_fixes/linkedin.py +++ b/requests_oauthlib/compliance_fixes/linkedin.py @@ -2,7 +2,10 @@ from oauthlib.common import add_params_to_uri, to_unicode +from deprecated import deprecated + +@deprecated("This compliance hook will be removed in version 1.4") def linkedin_compliance_fix(session): def _missing_token_type(r): token = loads(r.text) diff --git a/requirements-test-27.txt b/requirements-test-27.txt index 06226c4..8de6f4d 100644 --- a/requirements-test-27.txt +++ b/requirements-test-27.txt @@ -3,3 +3,4 @@ mock==3.0.5 requests-mock==1.9.3 requests==2.26.0 oauthlib[signedtoken]==3.1.0 +Python-Deprecated==1.1.0 diff --git a/requirements-test.txt b/requirements-test.txt index eba81b1..859eff4 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,3 +2,4 @@ coveralls==3.2.0 mock==4.0.3 requests-mock==1.9.3 +Python-Deprecated==1.1.0 diff --git a/requirements.txt b/requirements.txt index 3c8ff67..ddb032e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ requests==2.26.0 oauthlib[signedtoken]==3.1.1 +Python-Deprecated==1.1.0