Example #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)
Example #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)
Example #3
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()
     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)