Download the docuemnt. @param url: A document url. @type url: str. @return: A file pointer to the docuemnt. @rtype: file-like
(self, url)
| 81 | return d |
| 82 | |
| 83 | def download(self, url): |
| 84 | """ |
| 85 | Download the docuemnt. |
| 86 | @param url: A document url. |
| 87 | @type url: str. |
| 88 | @return: A file pointer to the docuemnt. |
| 89 | @rtype: file-like |
| 90 | """ |
| 91 | store = DocumentStore() |
| 92 | fp = store.open(url) |
| 93 | if fp is None: |
| 94 | fp = self.options.transport.open(Request(url)) |
| 95 | content = fp.read() |
| 96 | fp.close() |
| 97 | ctx = self.plugins.document.loaded(url=url, document=content) |
| 98 | content = ctx.document |
| 99 | sax = Parser() |
| 100 | return sax.parse(string=content) |
| 101 | |
| 102 | def cache(self): |
| 103 | """ |