Commits

Paul Tan committed 0219744

Fixed urlquote to be spec-compliant.

  • Participants
  • Parent commits 06fd833

Comments (0)

Files changed (1)

oauth1client/__init__.py

     return int(time())
 
 
-urlquote = _partial(urlquote, safe='')
+#urllib.parse.quote has the default safe(unreserved) character set as
+#_ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+#                         b'abcdefghijklmnopqrstuvwxyz'
+#                         b'0123456789'
+#                         b'_.-')
+#oauth has the unreserved character set as
+# ALPHA, DIGIT, "-", ".", "_", "~"
+urlquote = _partial(urlquote, safe='-._~')
 
 """ Credentials """
 
 def signature_base_string(method, uri, oauth_params = None, data = None):
     x = '{0}&{1}&{2}'.format(urlquote(method.upper()), urlquote(base_string_uri(uri)),
             urlquote(base_string_request_params(uri, oauth_params, data)))
-    #TODO: Working around tumblr!
-    x = x.replace('%257E','~')
     return x