url = fields.getvalue('url')
-# Optional Auth Basic
-auth = os.environ.get('HTTP_AUTHORIZATION') # auth == 'Basic cGhpbGlwcDpka2ZhamRrZg=='
-if auth: # empty string if HTTP_AUTHORIZATION not present
- auth_parts = auth.split(' ')
- auth_method = 'Basic'
- if len(auth_parts) != 2 or auth_parts[0] != auth_method:
- raise AuthWrongMethod()
- try:
- auth_decoded = base64.b64decode(auth_parts[1]) # auth_decoded == 'philipp:dkfajdkf'
- except TypeError:
- raise AuthBasicError()
- auth_decoded_parts = auth_decoded.split(':')
- if len(auth_decoded_parts) != 2:
- raise AuthBasicError()
- username, password = auth_decoded_parts
-
-
try:
+ # Optional Auth Basic
+ auth = os.environ.get('HTTP_AUTHORIZATION') # auth == 'Basic cGhpbGlwcDpka2ZhamRrZg=='
+ if auth: # empty string if HTTP_AUTHORIZATION not present
+ auth_parts = auth.split(' ')
+ auth_method = 'Basic'
+ if len(auth_parts) != 2 or auth_parts[0] != auth_method:
+ raise AuthWrongMethod()
+ try:
+ auth_decoded = base64.b64decode(auth_parts[1]) # auth_decoded == 'philipp:dkfajdkf'
+ except TypeError:
+ raise AuthBasicError()
+ auth_decoded_parts = auth_decoded.split(':')
+ if len(auth_decoded_parts) != 2:
+ raise AuthBasicError()
+ username, password = auth_decoded_parts
+
# check username and password
if username is None and password is None:
raise CredentialsMissing()