예제 #1
0
파일: vso.py 프로젝트: AlmightyFuzz/sunpy
    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
예제 #2
0
    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
예제 #3
0
 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"
예제 #4
0
 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
예제 #5
0
 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