def mk_filename(pattern, response, sock, url, overwrite=False): name = get_filename(sock, url) if not name: if not isinstance(response.fileid, text_type): name = u(response.fileid, "ascii", "ignore") else: name = response.fileid fs_encoding = sys.getfilesystemencoding() if fs_encoding is None: fs_encoding = "ascii" name = slugify(name) if PY2: name = name.encode(fs_encoding, "ignore") if not name: name = "file" fname = pattern.format(file=name, **dict(response)) if not overwrite and os.path.exists(fname): fname = replacement_filename(fname) dir_ = os.path.abspath(os.path.dirname(fname)) if not os.path.exists(dir_): os.makedirs(dir_) return fname
def mk_filename(pattern, response, sock, url, overwrite=False): name = get_filename(sock, url) if not name: if not isinstance(response.fileid, text_type): name = six.u(response.fileid, "ascii", "ignore") else: name = response.fileid fs_encoding = sys.getfilesystemencoding() if fs_encoding is None: fs_encoding = "ascii" name = slugify(name) if six.PY2: name = name.encode(fs_encoding, "ignore") if not name: name = "file" fname = pattern.format(file=name, **dict(response)) if not overwrite and os.path.exists(fname): fname = replacement_filename(fname) dir_ = os.path.abspath(os.path.dirname(fname)) if not os.path.exists(dir_): os.makedirs(dir_) return fname
def mk_filename(pattern, response, sock, url, overwrite=False): name = get_filename(sock, url) if not name: if not isinstance(response.fileid, text_type): name = six.u(response.fileid, "ascii", "ignore") else: name = response.fileid fs_encoding = sys.getfilesystemencoding() if fs_encoding is None: fs_encoding = "ascii"
def received(self, context): # received xml as a string self.last_payload = six.u(suds_unwrapper(context.reply)) # clean up reply to prevent parsing context.reply = "" return context