syntax errors
authorKenneth Reitz <me@kennethreitz.com>
Tue, 1 May 2012 11:06:55 +0000 (07:06 -0400)
committerKenneth Reitz <me@kennethreitz.com>
Tue, 1 May 2012 11:06:55 +0000 (07:06 -0400)
requests/auth.py

index 64f698edd0b26db6968b9b777169d646b4879d12..5d2d9820ca56d8c46068c7a418afd55b015358a1 100644 (file)
@@ -15,15 +15,15 @@ from base64 import b64encode
 from .compat import urlparse, str, is_py2
 from .utils import randombytes, parse_dict_header
 
-CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
-
-if is_py2:
+try:
     from oauthlib.oauth1.rfc5849 import (Client, SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER)
     from oauthlib.common import extract_params
-else:
+except (ImportError, SyntaxError):
     SIGNATURE_HMAC = None
     SIGNATURE_TYPE_AUTH_HEADER = None
 
+CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
+
 def _basic_auth_str(username, password):
     """Returns a Basic Auth string."""