def download_dropped_files(self, sha256, environment_id, target_dir):
        """Downloads the dropped files for this sample into target_dir.  Returns the list of files extracted."""

        download_url = '{}/api/sample-dropped-files/{}?environmentId={}&apikey={}&secret={}'.format(
            self.url,
            sha256,
            environment_id,
            self.api_key,
            self.secret)

        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            logging.info("downloading dropped files from {}".format(download_url))
            result = requests.get(download_url, verify=False, headers=VXSTREAM_HEADERS, proxies=self.proxies) # XXX

        if result.status_code != 200:
            logging.error("got result {} from vxstream for {}: {}".format(result.status_code, download_url, result.reason))
            return None

        # put what we download into a temporary directory
        temp_dir = tempfile.mkdtemp()
        try:
            # all dropped files come in a zip file
            compressed_path = os.path.join(temp_dir, 'download.zip')

            # write zip file to disk
            with open(compressed_path, 'wb') as fp:
                for block in result.iter_content(io.DEFAULT_BUFFER_SIZE):
                    fp.write(block)

            # unzip without paths
            p = Popen(['7z', 'e', '-y', '-o{}'.format(target_dir), compressed_path], stdout=PIPE, stderr=PIPE)
            stdout, stderr = p.communicate()

            try:
                os.remove(compressed_path)
            except Exception as e:
                logging.error("unable to delete {}: {}".format(compressed_path, e))

            # list gz files in drop_path
            file_list = [os.path.join(target_dir, f) for f in os.listdir(target_dir) if f.endswith('.gz')]

            result = []
            for compressed_path in file_list:
                # there are some other files in here sometimes that we'll ignore
                # we just want the dropped file
                if '.DROPPED.' not in compressed_path:
                    continue

                DROPPED_FILE_REGEX = re.compile(r'^(.+?)\.[0-9]+\.DROPPED\.gz')

                # the file paths look like this
                # dropped/78QC7UOHAWCI47906LWH.temp.4212842214.DROPPED.gZ
                m = DROPPED_FILE_REGEX.match(os.path.basename(compressed_path))
                if not m:
                    logging.error("could not extract file name from {}".format(compressed_path))
                    continue

                target_path = os.path.join(target_dir, m.group(1))
                result.append(target_path)

                with gzip.open(compressed_path) as fp:
                    logging.debug("decompressing {}".format(compressed_path))
                    with open(target_path, 'wb') as dest_fp:
                        while True:
                            data = fp.read(io.DEFAULT_BUFFER_SIZE)
                            if data == b'':
                                break

                            dest_fp.write(data)

                os.remove(compressed_path)

            return result

        finally:

            try:
                if temp_dir:
                    shutil.rmtree(temp_dir)
            except Exception as e:
                logging.error("unable to delete temporary directory {}: {}".format(temp_dir, e))
Downloads the dropped files for this sample into target_dir.  Returns the list of files extracted.