mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Bump requests-oauthlib from 1.3.0 to 1.3.1 (#1636)
* Bump requests-oauthlib from 1.3.0 to 1.3.1 Bumps [requests-oauthlib](https://github.com/requests/requests-oauthlib) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/requests/requests-oauthlib/releases) - [Changelog](https://github.com/requests/requests-oauthlib/blob/master/HISTORY.rst) - [Commits](https://github.com/requests/requests-oauthlib/compare/v1.3.0...v1.3.1) --- updated-dependencies: - dependency-name: requests-oauthlib dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update requests-oauthlib==1.3.1 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
5523d4ba88
commit
61960aa744
26 changed files with 464 additions and 77 deletions
|
@ -2,9 +2,9 @@ from __future__ import absolute_import
|
|||
|
||||
from .facebook import facebook_compliance_fix
|
||||
from .fitbit import fitbit_compliance_fix
|
||||
from .linkedin import linkedin_compliance_fix
|
||||
from .slack import slack_compliance_fix
|
||||
from .instagram import instagram_compliance_fix
|
||||
from .mailchimp import mailchimp_compliance_fix
|
||||
from .weibo import weibo_compliance_fix
|
||||
from .plentymarkets import plentymarkets_compliance_fix
|
||||
from .ebay import ebay_compliance_fix
|
||||
|
|
23
lib/requests_oauthlib/compliance_fixes/ebay.py
Normal file
23
lib/requests_oauthlib/compliance_fixes/ebay.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import json
|
||||
from oauthlib.common import to_unicode
|
||||
|
||||
|
||||
def ebay_compliance_fix(session):
|
||||
def _compliance_fix(response):
|
||||
token = json.loads(response.text)
|
||||
|
||||
# eBay responds with non-compliant token types.
|
||||
# https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html
|
||||
# https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html
|
||||
# Modify these to be "Bearer".
|
||||
if token.get("token_type") in ["Application Access Token", "User Access Token"]:
|
||||
token["token_type"] = "Bearer"
|
||||
fixed_token = json.dumps(token)
|
||||
response._content = to_unicode(fixed_token).encode("utf-8")
|
||||
|
||||
return response
|
||||
|
||||
session.register_compliance_hook("access_token_response", _compliance_fix)
|
||||
session.register_compliance_hook("refresh_token_response", _compliance_fix)
|
||||
|
||||
return session
|
|
@ -1,21 +0,0 @@
|
|||
from json import loads, dumps
|
||||
|
||||
from oauthlib.common import add_params_to_uri, to_unicode
|
||||
|
||||
|
||||
def linkedin_compliance_fix(session):
|
||||
def _missing_token_type(r):
|
||||
token = loads(r.text)
|
||||
token["token_type"] = "Bearer"
|
||||
r._content = to_unicode(dumps(token)).encode("UTF-8")
|
||||
return r
|
||||
|
||||
def _non_compliant_param_name(url, headers, data):
|
||||
token = [("oauth2_access_token", session.access_token)]
|
||||
url = add_params_to_uri(url, token)
|
||||
return url, headers, data
|
||||
|
||||
session._client.default_token_placement = "query"
|
||||
session.register_compliance_hook("access_token_response", _missing_token_type)
|
||||
session.register_compliance_hook("protected_request", _non_compliant_param_name)
|
||||
return session
|
Loading…
Add table
Add a link
Reference in a new issue