mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Update oauthlib-3.1.1
This commit is contained in:
parent
e58aa40099
commit
d76838a607
64 changed files with 4329 additions and 1421 deletions
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
oauthlib.utils
|
||||
~~~~~~~~~~~~~~
|
||||
|
@ -6,14 +5,9 @@ oauthlib.utils
|
|||
This module contains utility methods used by various parts of the OAuth
|
||||
spec.
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
import urllib.request as urllib2
|
||||
|
||||
try:
|
||||
import urllib2
|
||||
except ImportError:
|
||||
import urllib.request as urllib2
|
||||
|
||||
from oauthlib.common import quote, unquote, bytes_type, unicode_type
|
||||
from oauthlib.common import quote, unquote
|
||||
|
||||
UNICODE_ASCII_CHARACTER_SET = ('abcdefghijklmnopqrstuvwxyz'
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
|
@ -48,19 +42,19 @@ def escape(u):
|
|||
|
||||
Per `section 3.6`_ of the spec.
|
||||
|
||||
.. _`section 3.6`: http://tools.ietf.org/html/rfc5849#section-3.6
|
||||
.. _`section 3.6`: https://tools.ietf.org/html/rfc5849#section-3.6
|
||||
|
||||
"""
|
||||
if not isinstance(u, unicode_type):
|
||||
if not isinstance(u, str):
|
||||
raise ValueError('Only unicode objects are escapable. ' +
|
||||
'Got %s of type %s.' % (u, type(u)))
|
||||
'Got {!r} of type {}.'.format(u, type(u)))
|
||||
# Letters, digits, and the characters '_.-' are already treated as safe
|
||||
# by urllib.quote(). We need to add '~' to fully support rfc5849.
|
||||
return quote(u, safe=b'~')
|
||||
|
||||
|
||||
def unescape(u):
|
||||
if not isinstance(u, unicode_type):
|
||||
if not isinstance(u, str):
|
||||
raise ValueError('Only unicode objects are unescapable.')
|
||||
return unquote(u)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue