Skip to content

Commit

Permalink
Revert linkedin compliance fix, adds deprecation warning instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Troussard committed Feb 22, 2022
1 parent 996e2f5 commit 811f470
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Patches and Suggestions
- Sylvain Marie <[email protected]>
- Craig Anderson <[email protected]>
- Hugo van Kemenade <https://github.com/hugovk>
- Jacques Troussard <https://developerslifefor.me>
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ v1.4.0 (TBD)
is provided and ``scope`` is not overridden. Fixes `#408
<https://github.com/requests/requests-oauthlib/issues/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)
++++++++++++++++++++++++

Expand Down
19 changes: 13 additions & 6 deletions docs/examples/linkedin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ command line interactive example below.
>>> client_id = '<the id you get from linkedin>'
>>> client_secret = '<the secret you get from linkedin>'
>>> # 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:https://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
Expand All @@ -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)
3 changes: 3 additions & 0 deletions requests_oauthlib/compliance_fixes/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions requirements-test-27.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
coveralls==3.2.0
mock==4.0.3
requests-mock==1.9.3
Python-Deprecated==1.1.0
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests>=2.0.0
oauthlib[signedtoken]>=3.0.0
Python-Deprecated==1.1.0
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests==2.26.0
oauthlib[signedtoken]==3.1.1
Python-Deprecated==1.1.0

0 comments on commit 811f470

Please sign in to comment.