summaryrefslogtreecommitdiff
path: root/oauthlib/common.py
diff options
context:
space:
mode:
authorIb Lundgren <ib.lundgren@gmail.com>2014-09-24 17:24:14 +0100
committerIb Lundgren <ib.lundgren@gmail.com>2014-09-24 17:24:14 +0100
commit1071fde2f715c9564d19f4e5eee6a5910c2839b1 (patch)
treee2371623fe9f1c9780fc06c7e9e920ad7e499b0c /oauthlib/common.py
parent39013947bd2e242dda85fb0f150c49be23fd7510 (diff)
downloadoauthlib-alternative_crypto_library.tar.gz
Allow alternative crypto library cryptography.alternative_crypto_library
An alternative to PyCrypto is taking form and it would be nice to allow users to choose which library they prefer to use for their RSA signing. CC #226.
Diffstat (limited to 'oauthlib/common.py')
-rw-r--r--oauthlib/common.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/oauthlib/common.py b/oauthlib/common.py
index d3e2edb..01ca775 100644
--- a/oauthlib/common.py
+++ b/oauthlib/common.py
@@ -329,6 +329,11 @@ def to_unicode(data, encoding='UTF-8'):
return data
+def to_bytes(data, encoding='UTF-8'):
+ data = to_unicode(data, encoding=encoding)
+ return data.encode(encoding)
+
+
class CaseInsensitiveDict(dict):
"""Basic case insensitive dict with strings only keys."""