示例#1
0
 def download(self, url):
     """
     Download the docuemnt.
     @param url: A document url.
     @type url: str.
     @return: A file pointer to the docuemnt.
     @rtype: file-like
     """
     store = DocumentStore()
     fp = store.open(url)
     if fp is None:
         fp = self.options.transport.open(Request(url))
     sax = Parser()
     return sax.parse(file=fp)
示例#2
0
 def download(self, url):
     """
     Download the docuemnt.
     @param url: A document url.
     @type url: str.
     @return: A file pointer to the docuemnt.
     @rtype: file-like
     """
     store = DocumentStore()
     fp = store.open(url)
     if fp is None:
         fp = self.options.transport.open(Request(url))
     sax = Parser()
     return sax.parse(file=fp)
示例#3
0
文件: reader.py 项目: ortsed/suds
 def download(self, url):
     """
     Download the docuemnt.
     @param url: A document url.
     @type url: str.
     @return: A file pointer to the docuemnt.
     @rtype: file-like
     """
     store = DocumentStore()
     if url.startswith('http') or url.startswith('suds'):
         fp = store.open(url)
         if fp is None:
             fp = self.options.transport.open(Request(url))
     else:
         fp = open(url, 'r')
     sax = Parser()
     return sax.parse(file=fp)
 def download(self, url):
     """
     Download the docuemnt.
     @param url: A document url.
     @type url: str.
     @return: A file pointer to the docuemnt.
     @rtype: file-like
     """
     store = DocumentStore()
     fp = store.open(url)
     if fp is None:
         fp = self.options.transport.open(Request(url))
     content = fp.read()
     fp.close()
     ctx = self.plugins.document.loaded(url=url, document=content)
     content = ctx.document
     sax = Parser()
     return sax.parse(string=content)