diff --git a/lib/connection/__init__.py b/lib/connection/__init__.py index e121fe5fd..87c566230 100755 --- a/lib/connection/__init__.py +++ b/lib/connection/__init__.py @@ -17,7 +17,7 @@ # Author: Mauro Soria -from Requester import * -from RequestException import * -from Response import * +from .Requester import * +from .RequestException import * +from .Response import * pass diff --git a/lib/controller/__init__.py b/lib/controller/__init__.py index d509b617f..5ef4a7d90 100755 --- a/lib/controller/__init__.py +++ b/lib/controller/__init__.py @@ -17,5 +17,5 @@ # Author: Mauro Soria -from Controller import * +from .Controller import * pass \ No newline at end of file diff --git a/lib/core/ArgumentsParser.py b/lib/core/ArgumentsParser.py index d1514e422..61e5aff87 100755 --- a/lib/core/ArgumentsParser.py +++ b/lib/core/ArgumentsParser.py @@ -18,7 +18,7 @@ -import ConfigParser +import configparser from optparse import OptionParser, OptionGroup from lib.utils.FileUtils import File from lib.utils.FileUtils import FileUtils @@ -37,32 +37,32 @@ def __init__(self, script_path): if options.urlList != None: with File(options.urlList) as urlList: if not urlList.exists(): - print "The file with URLs does not exist" + print("The file with URLs does not exist") exit(0) if not urlList.isValid(): - print 'The wordlist is invalid' + print('The wordlist is invalid') exit(0) if not urlList.canRead(): - print 'The wordlist cannot be read' + print('The wordlist cannot be read') exit(0) self.urlList = list(urlList.getLines()) elif options.url == None: - print 'Url target is missing' + print('Url target is missing') exit(0) else: self.urlList = [options.url] if options.extensions == None: - print 'No extension specified. You must specify at least one extension' + print('No extension specified. You must specify at least one extension') exit(0) with File(options.wordlist) as wordlist: if not wordlist.exists(): - print 'The wordlist file does not exist' + print('The wordlist file does not exist') exit(0) if not wordlist.isValid(): - print 'The wordlist is invalid' + print('The wordlist is invalid') exit(0) if not wordlist.canRead(): - print 'The wordlist cannot be read' + print('The wordlist cannot be read') exit(0) if options.httpProxy is not None: if options.httpProxy.startswith('http://'): @@ -75,8 +75,8 @@ def __init__(self, script_path): try: self.headers = dict((key.strip(), value.strip()) for (key, value) in (header.split(':', 1) for header in options.headers)) - except Exception, e: - print 'Invalid headers' + except Exception as e: + print('Invalid headers') exit(0) else: self.headers = {} @@ -85,7 +85,7 @@ def __init__(self, script_path): self.useragent = options.useragent self.cookie = options.cookie if options.threadsCount < 1: - print 'Threads number must be a number greater than zero' + print('Threads number must be a number greater than zero') exit(0) self.threadsCount = options.threadsCount if options.excludeStatusCodes is not None: @@ -115,7 +115,7 @@ def __init__(self, script_path): self.scanSubdirs = list(oset([subdir + "/" for subdir in self.scanSubdirs])) else: self.scanSubdirs = None if not self.recursive and options.excludeSubdirs is not None: - print '--exclude-subdir argument can only be used with -r|--recursive' + print('--exclude-subdir argument can only be used with -r|--recursive') exit(0) elif options.excludeSubdirs is not None: self.excludeSubdirs = list(oset([subdir.strip() for subdir in options.excludeSubdirs.split(',')])) @@ -138,7 +138,7 @@ def parseConfig(self): config.read(configPath) # General - self.threadsCount = config.safe_getint("general", "threads", 10, range(1, 50)) + self.threadsCount = config.safe_getint("general", "threads", 10, list(range(1, 50))) self.excludeStatusCodes = config.safe_get("general", "exclude-status", None) self.redirect = config.safe_getboolean("general", "follow-redirects", False) self.recursive = config.safe_getboolean("general", "recursive", False) diff --git a/lib/core/__init__.py b/lib/core/__init__.py index 1a27ae4ae..2630b01fc 100755 --- a/lib/core/__init__.py +++ b/lib/core/__init__.py @@ -17,8 +17,8 @@ # Author: Mauro Soria -from FuzzerDictionary import * -from Fuzzer import * -from ArgumentsParser import * -from Path import * +from .FuzzerDictionary import * +from .Fuzzer import * +from .ArgumentsParser import * +from .Path import * pass diff --git a/lib/output/CLIOutput.py b/lib/output/CLIOutput.py index 6a925be29..701973954 100755 --- a/lib/output/CLIOutput.py +++ b/lib/output/CLIOutput.py @@ -101,7 +101,7 @@ def printStatusReport(self, path, response): if path in self.checkedPaths: self.mutexCheckedPaths.release() return - except (KeyboardInterrupt, SystemExit), e: + except (KeyboardInterrupt, SystemExit) as e: raise e finally: self.mutexCheckedPaths.release() diff --git a/lib/output/__init__.py b/lib/output/__init__.py index c0830b76b..5e79e1eac 100755 --- a/lib/output/__init__.py +++ b/lib/output/__init__.py @@ -1,3 +1,3 @@ -from CLIOutput import * +from .CLIOutput import * pass \ No newline at end of file diff --git a/lib/reports/__init__.py b/lib/reports/__init__.py index 7ee279775..280c9dbf7 100755 --- a/lib/reports/__init__.py +++ b/lib/reports/__init__.py @@ -17,8 +17,8 @@ # Author: Mauro Soria -from BaseReport import * -from SimpleReport import * -from PlainTextReport import * -from JSONReport import * +from .BaseReport import * +from .SimpleReport import * +from .PlainTextReport import * +from .JSONReport import * pass diff --git a/lib/test/__init__.py b/lib/test/__init__.py index bcdd776aa..a109e04b2 100755 --- a/lib/test/__init__.py +++ b/lib/test/__init__.py @@ -17,6 +17,6 @@ # Author: Mauro Soria -from ContentTester import * -from StatusTester import * +from .ContentTester import * +from .StatusTester import * pass diff --git a/lib/utils/DefaultConfigParser.py b/lib/utils/DefaultConfigParser.py index 20d10cc5c..072deca2e 100755 --- a/lib/utils/DefaultConfigParser.py +++ b/lib/utils/DefaultConfigParser.py @@ -17,49 +17,49 @@ # Author: Mauro Soria -import ConfigParser +import configparser -class DefaultConfigParser(ConfigParser.ConfigParser): +class DefaultConfigParser(configparser.ConfigParser): def __init__(self): - ConfigParser.ConfigParser.__init__(self) + configparser.ConfigParser.__init__(self) def safe_get(self, section, option, default, allowed=None): try: - result = ConfigParser.ConfigParser.get(self, section, option) + result = configparser.ConfigParser.get(self, section, option) if allowed is not None: return result if result in allowed else default else: return result - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + except (configparser.NoSectionError, configparser.NoOptionError): return default def safe_getfloat(self, section, option, default, allowed=None): try: - result = ConfigParser.ConfigParser.getfloat(self, section, option) + result = configparser.ConfigParser.getfloat(self, section, option) if allowed is not None: return result if result in allowed else default else: return result - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + except (configparser.NoSectionError, configparser.NoOptionError): return default def safe_getboolean(self, section, option, default, allowed=None): try: - result = ConfigParser.ConfigParser.getboolean(self, section, option) + result = configparser.ConfigParser.getboolean(self, section, option) if allowed is not None: return result if result in allowed else default else: return result - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + except (configparser.NoSectionError, configparser.NoOptionError): return default def safe_getint(self, section, option, default, allowed=None): try: - result = ConfigParser.ConfigParser.getint(self, section, option) + result = configparser.ConfigParser.getint(self, section, option) if allowed is not None: return result if result in allowed else default else: return result - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + except (configparser.NoSectionError, configparser.NoOptionError): return default \ No newline at end of file diff --git a/thirdparty/oset/__init__.py b/thirdparty/oset/__init__.py index 688b31e92..735186dc6 100644 --- a/thirdparty/oset/__init__.py +++ b/thirdparty/oset/__init__.py @@ -1,3 +1,3 @@ """Main Ordered Set module """ -from pyoset import oset +from .pyoset import oset diff --git a/thirdparty/oset/_abc.py b/thirdparty/oset/_abc.py index b155c7474..7a967ad6f 100644 --- a/thirdparty/oset/_abc.py +++ b/thirdparty/oset/_abc.py @@ -3,7 +3,7 @@ """Partially backported python ABC classes""" -from __future__ import absolute_import + import sys import types @@ -65,7 +65,7 @@ def __new__(mcls, name, bases, namespace): cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace) # Compute set of abstract method names abstracts = set(name - for name, value in namespace.items() + for name, value in list(namespace.items()) if getattr(value, "__isabstractmethod__", False)) for base in bases: for name in getattr(base, "__abstractmethods__", set()): @@ -82,7 +82,7 @@ def __new__(mcls, name, bases, namespace): def register(cls, subclass): """Register a virtual subclass of an ABC.""" - if not isinstance(subclass, (type, types.ClassType)): + if not isinstance(subclass, type): raise TypeError("Can only register classes") if issubclass(subclass, cls): return # Already a subclass @@ -96,12 +96,12 @@ def register(cls, subclass): def _dump_registry(cls, file=None): """Debug helper to print the ABC registry.""" - print >> file, "Class: %s.%s" % (cls.__module__, cls.__name__) - print >> file, "Inv.counter: %s" % ABCMeta._abc_invalidation_counter + print("Class: %s.%s" % (cls.__module__, cls.__name__), file=file) + print("Inv.counter: %s" % ABCMeta._abc_invalidation_counter, file=file) for name in sorted(cls.__dict__.keys()): if name.startswith("_abc_"): value = getattr(cls, name) - print >> file, "%s: %r" % (name, value) + print("%s: %r" % (name, value), file=file) def __instancecheck__(cls, instance): """Override for isinstance(instance, cls).""" @@ -171,9 +171,7 @@ def _hasattr(C, attr): return hasattr(C, attr) -class Sized: - __metaclass__ = ABCMeta - +class Sized(metaclass=ABCMeta): @abstractmethod def __len__(self): return 0 @@ -186,9 +184,7 @@ def __subclasshook__(cls, C): return NotImplemented -class Container: - __metaclass__ = ABCMeta - +class Container(metaclass=ABCMeta): @abstractmethod def __contains__(self, x): return False @@ -201,9 +197,7 @@ def __subclasshook__(cls, C): return NotImplemented -class Iterable: - __metaclass__ = ABCMeta - +class Iterable(metaclass=ABCMeta): @abstractmethod def __iter__(self): while False: @@ -322,7 +316,7 @@ def _hash(self): freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type. """ - MAX = sys.maxint + MAX = sys.maxsize MASK = 2 * MAX + 1 n = len(self) h = 1927868237 * (n + 1) @@ -364,7 +358,7 @@ def pop(self): """Return the popped value. Raise KeyError if empty.""" it = iter(self) try: - value = it.next() + value = next(it) except StopIteration: raise KeyError self.discard(value) @@ -453,7 +447,7 @@ def __reversed__(self): def pop(self, last=True): if not self: raise KeyError('set is empty') - key = reversed(self).next() if last else iter(self).next() + key = next(reversed(self)) if last else next(iter(self)) self.discard(key) return key @@ -471,5 +465,5 @@ def __del__(self): self.clear() # remove circular references if __name__ == '__main__': - print(OrderedSet('abracadaba')) - print(OrderedSet('simsalabim')) + print((OrderedSet('abracadaba'))) + print((OrderedSet('simsalabim'))) diff --git a/thirdparty/oset/pyoset.py b/thirdparty/oset/pyoset.py index e77707d59..cf7874eca 100644 --- a/thirdparty/oset/pyoset.py +++ b/thirdparty/oset/pyoset.py @@ -3,7 +3,7 @@ """Partially backported python ABC classes""" -from __future__ import absolute_import + try: from collections import MutableSet @@ -12,7 +12,7 @@ from ._abc import MutableSet -KEY, PREV, NEXT = range(3) +KEY, PREV, NEXT = list(range(3)) class OrderedSet(MutableSet): @@ -62,7 +62,7 @@ def __reversed__(self): def pop(self, last=True): if not self: raise KeyError('set is empty') - key = reversed(self).next() if last else iter(self).next() + key = next(reversed(self)) if last else next(iter(self)) self.discard(key) return key diff --git a/thirdparty/oset/tests.py b/thirdparty/oset/tests.py index 36f53f260..0bcdf6371 100644 --- a/thirdparty/oset/tests.py +++ b/thirdparty/oset/tests.py @@ -3,7 +3,7 @@ """Partially backported python ABC classes""" -from __future__ import absolute_import + import doctest import unittest diff --git a/thirdparty/sqlmap/DynamicContentParser.py b/thirdparty/sqlmap/DynamicContentParser.py index 31abec4f5..d65d5e27c 100644 --- a/thirdparty/sqlmap/DynamicContentParser.py +++ b/thirdparty/sqlmap/DynamicContentParser.py @@ -70,7 +70,7 @@ def findDynamicContent(firstPage, secondPage): blocks.insert(0, None) blocks.append(None) - for i in xrange(len(blocks) - 1): + for i in range(len(blocks) - 1): prefix = firstPage[blocks[i][0]:blocks[i][0] + blocks[i][2]] if blocks[i] else None suffix = firstPage[blocks[i + 1][0]:blocks[i + 1][0] + blocks[i + 1][2]] if blocks[i + 1] else None diff --git a/thirdparty/sqlmap/__init__.py b/thirdparty/sqlmap/__init__.py index 1adfb0c6e..ac28725cc 100644 --- a/thirdparty/sqlmap/__init__.py +++ b/thirdparty/sqlmap/__init__.py @@ -1,3 +1,3 @@ -from DynamicContentParser import * +from .DynamicContentParser import * pass \ No newline at end of file diff --git a/thirdparty/urllib3/_collections.py b/thirdparty/urllib3/_collections.py index 5907b0dc7..fda29a603 100644 --- a/thirdparty/urllib3/_collections.py +++ b/thirdparty/urllib3/_collections.py @@ -100,4 +100,4 @@ def clear(self): def keys(self): with self.lock: - return self._container.keys() + return list(self._container.keys()) diff --git a/thirdparty/urllib3/connection.py b/thirdparty/urllib3/connection.py index e240786a6..9cff1dd50 100644 --- a/thirdparty/urllib3/connection.py +++ b/thirdparty/urllib3/connection.py @@ -10,7 +10,7 @@ try: # Python 3 from http.client import HTTPConnection, HTTPException except ImportError: - from httplib import HTTPConnection, HTTPException + from http.client import HTTPConnection, HTTPException class DummyConnection(object): "Used to detect a failed ConnectionCls import." @@ -26,7 +26,7 @@ class BaseSSLError(BaseException): try: # Python 3 from http.client import HTTPSConnection except ImportError: - from httplib import HTTPSConnection + from http.client import HTTPSConnection import ssl BaseSSLError = ssl.SSLError diff --git a/thirdparty/urllib3/connectionpool.py b/thirdparty/urllib3/connectionpool.py index 72011b5a3..2affcc38a 100644 --- a/thirdparty/urllib3/connectionpool.py +++ b/thirdparty/urllib3/connectionpool.py @@ -13,8 +13,8 @@ try: # Python 3 from queue import LifoQueue, Empty, Full except ImportError: - from Queue import LifoQueue, Empty, Full - import Queue as _ # Platform-specific: Windows + from queue import LifoQueue, Empty, Full + import queue as _ # Platform-specific: Windows from .exceptions import ( @@ -160,7 +160,7 @@ def __init__(self, host, port=None, strict=False, self.proxy_headers = _proxy_headers or {} # Fill the queue up so that doing get() on it will block properly - for _ in xrange(maxsize): + for _ in range(maxsize): self.pool.put(None) # These are mostly for testing and debugging purposes. diff --git a/thirdparty/urllib3/contrib/ntlmpool.py b/thirdparty/urllib3/contrib/ntlmpool.py index b8cd93303..c2c6eccc0 100644 --- a/thirdparty/urllib3/contrib/ntlmpool.py +++ b/thirdparty/urllib3/contrib/ntlmpool.py @@ -13,7 +13,7 @@ try: from http.client import HTTPSConnection except ImportError: - from httplib import HTTPSConnection + from http.client import HTTPSConnection from logging import getLogger from ntlm import ntlm diff --git a/thirdparty/urllib3/contrib/pyopenssl.py b/thirdparty/urllib3/contrib/pyopenssl.py index f78e71706..226894f2d 100644 --- a/thirdparty/urllib3/contrib/pyopenssl.py +++ b/thirdparty/urllib3/contrib/pyopenssl.py @@ -27,7 +27,7 @@ from socket import _fileobject import ssl import select -from cStringIO import StringIO +from io import StringIO from .. import connection from .. import util diff --git a/thirdparty/urllib3/fields.py b/thirdparty/urllib3/fields.py index ed017657a..ff9c04032 100644 --- a/thirdparty/urllib3/fields.py +++ b/thirdparty/urllib3/fields.py @@ -131,7 +131,7 @@ def _render_parts(self, header_parts): parts = [] iterable = header_parts if isinstance(header_parts, dict): - iterable = header_parts.items() + iterable = list(header_parts.items()) for name, value in iterable: if value: @@ -150,7 +150,7 @@ def render_headers(self): if self.headers.get(sort_key, False): lines.append('%s: %s' % (sort_key, self.headers[sort_key])) - for header_name, header_value in self.headers.items(): + for header_name, header_value in list(self.headers.items()): if header_name not in sort_keys: if header_value: lines.append('%s: %s' % (header_name, header_value)) diff --git a/thirdparty/urllib3/packages/__init__.py b/thirdparty/urllib3/packages/__init__.py index 37e835157..ec2d3b4af 100644 --- a/thirdparty/urllib3/packages/__init__.py +++ b/thirdparty/urllib3/packages/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import ssl_match_hostname diff --git a/thirdparty/urllib3/packages/ordered_dict.py b/thirdparty/urllib3/packages/ordered_dict.py index 7f8ee1543..6e3fbe134 100644 --- a/thirdparty/urllib3/packages/ordered_dict.py +++ b/thirdparty/urllib3/packages/ordered_dict.py @@ -4,9 +4,9 @@ # http://code.activestate.com/recipes/576693/ try: - from thread import get_ident as _get_ident + from _thread import get_ident as _get_ident except ImportError: - from dummy_thread import get_ident as _get_ident + from _dummy_thread import get_ident as _get_ident try: from _abcoll import KeysView, ValuesView, ItemsView @@ -80,7 +80,7 @@ def __reversed__(self): def clear(self): 'od.clear() -> None. Remove all items from od.' try: - for node in self.__map.itervalues(): + for node in self.__map.values(): del node[:] root = self.__root root[:] = [root, root, None] @@ -163,12 +163,12 @@ def update(*args, **kwds): for key in other: self[key] = other[key] elif hasattr(other, 'keys'): - for key in other.keys(): + for key in list(other.keys()): self[key] = other[key] else: for key, value in other: self[key] = value - for key, value in kwds.items(): + for key, value in list(kwds.items()): self[key] = value __update = update # let subclasses override update without breaking __init__ @@ -204,7 +204,7 @@ def __repr__(self, _repr_running={}): try: if not self: return '%s()' % (self.__class__.__name__,) - return '%s(%r)' % (self.__class__.__name__, self.items()) + return '%s(%r)' % (self.__class__.__name__, list(self.items())) finally: del _repr_running[call_key] @@ -239,7 +239,7 @@ def __eq__(self, other): ''' if isinstance(other, OrderedDict): - return len(self)==len(other) and self.items() == other.items() + return len(self)==len(other) and list(self.items()) == list(other.items()) return dict.__eq__(self, other) def __ne__(self, other): diff --git a/thirdparty/urllib3/packages/six.py b/thirdparty/urllib3/packages/six.py index 27d80112b..d38aa51fc 100644 --- a/thirdparty/urllib3/packages/six.py +++ b/thirdparty/urllib3/packages/six.py @@ -39,10 +39,10 @@ MAXSIZE = sys.maxsize else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode + string_types = str, + integer_types = (int, int) + class_types = (type, type) + text_type = str binary_type = str if sys.platform.startswith("java"): @@ -228,7 +228,7 @@ def remove_move(name): advance_iterator = next except NameError: def advance_iterator(it): - return it.next() + return it.__next__() next = advance_iterator @@ -242,11 +242,11 @@ def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) else: def get_unbound_function(unbound): - return unbound.im_func + return unbound.__func__ class Iterator(object): - def next(self): + def __next__(self): return type(self).__next__(self) callable = callable @@ -291,10 +291,10 @@ def int2byte(i): def b(s): return s def u(s): - return unicode(s, "unicode_escape") + return str(s, "unicode_escape") int2byte = chr - import StringIO - StringIO = BytesIO = StringIO.StringIO + import io + StringIO = BytesIO = io.StringIO _add_doc(b, """Byte literal""") _add_doc(u, """Text literal""") @@ -338,19 +338,19 @@ def print_(*args, **kwargs): if fp is None: return def write(data): - if not isinstance(data, basestring): + if not isinstance(data, str): data = str(data) fp.write(data) want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: - if isinstance(sep, unicode): + if isinstance(sep, str): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: - if isinstance(end, unicode): + if isinstance(end, str): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") @@ -358,12 +358,12 @@ def write(data): raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: - if isinstance(arg, unicode): + if isinstance(arg, str): want_unicode = True break if want_unicode: - newline = unicode("\n") - space = unicode(" ") + newline = str("\n") + space = str(" ") else: newline = "\n" space = " " diff --git a/thirdparty/urllib3/packages/ssl_match_hostname/__init__.py b/thirdparty/urllib3/packages/ssl_match_hostname/__init__.py index 3aa5b2e19..dd59a75fd 100644 --- a/thirdparty/urllib3/packages/ssl_match_hostname/__init__.py +++ b/thirdparty/urllib3/packages/ssl_match_hostname/__init__.py @@ -7,7 +7,7 @@ from backports.ssl_match_hostname import CertificateError, match_hostname except ImportError: # Our vendored copy - from _implementation import CertificateError, match_hostname + from ._implementation import CertificateError, match_hostname # Not needed, but documenting what we provide. __all__ = ('CertificateError', 'match_hostname') diff --git a/thirdparty/urllib3/poolmanager.py b/thirdparty/urllib3/poolmanager.py index c16519f88..4cd532d47 100644 --- a/thirdparty/urllib3/poolmanager.py +++ b/thirdparty/urllib3/poolmanager.py @@ -9,7 +9,7 @@ try: # Python 3 from urllib.parse import urljoin except ImportError: - from urlparse import urljoin + from urllib.parse import urljoin from ._collections import RecentlyUsedContainer from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool diff --git a/thirdparty/urllib3/request.py b/thirdparty/urllib3/request.py index 66a9a0e69..bd130411e 100644 --- a/thirdparty/urllib3/request.py +++ b/thirdparty/urllib3/request.py @@ -7,7 +7,7 @@ try: from urllib.parse import urlencode except ImportError: - from urllib import urlencode + from urllib.parse import urlencode from .filepost import encode_multipart_formdata diff --git a/thirdparty/urllib3/response.py b/thirdparty/urllib3/response.py index 6a1fe1a77..633b0402a 100644 --- a/thirdparty/urllib3/response.py +++ b/thirdparty/urllib3/response.py @@ -10,7 +10,7 @@ import io from .exceptions import DecodeError -from .packages.six import string_types as basestring, binary_type +from .packages.six import string_types as str, binary_type from .util import is_fp_closed @@ -87,7 +87,7 @@ def __init__(self, body='', headers=None, status=0, version=0, reason=None, self.decode_content = decode_content self._decoder = None - self._body = body if body and isinstance(body, basestring) else None + self._body = body if body and isinstance(body, str) else None self._fp = None self._original_response = original_response self._fp_bytes_read = 0