Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 8dbf8cd

Browse files
committed
force check for None on email/key/token/certtoken
1 parent e7224a8 commit 8dbf8cd

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

CloudFlare/cloudflare.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ def _raw(self, method, headers, parts, identifiers, params, data_str, data_json,
453453

454454
if response_type in ['text/javascript', 'application/javascript', 'text/html']:
455455
# used by Cloudflare workers
456+
456457
if hasattr(response_data, 'decode'):
457458
response_data = response_data.decode('utf-8')
458459
return {'success': True, 'result': str(response_data)}
@@ -877,14 +878,14 @@ def __init__(self, email=None, key=None, token=None, certtoken=None, debug=False
877878

878879
self._base = None
879880

880-
if email and not isinstance(email, str):
881-
raise TypeError('email must be str')
882-
if key and not isinstance(key, str):
883-
raise TypeError('key must be str')
884-
if token and not isinstance(token, str):
885-
raise TypeError('token must be str')
886-
if certtoken and not isinstance(certtoken, str):
887-
raise TypeError('certtoken must be str')
881+
if email is not None and not isinstance(email, str):
882+
raise TypeError('email is %s - must be str' % (type(email)))
883+
if key is not None and not isinstance(key, str):
884+
raise TypeError('key is %s - must be str' % (type(key)))
885+
if token is not None and not isinstance(token, str):
886+
raise TypeError('token is %s - must be str' % (type(token)))
887+
if certtoken is not None and not isinstance(certtoken, str):
888+
raise TypeError('certtoken is %s - must be str' % (type(certtoken)))
888889

889890
try:
890891
config = read_configs(profile)

0 commit comments

Comments
 (0)