PdfFileReader reads the content from a pdf file to create an object.
I am querying the pdf from a cdn via urllib.urlopen(), this provides me a file like object, which has no seek. PdfFileReader, however uses seek.
What is the simple way to create a PdfFileReader object from a pdf downloaded via url.
Now, what can I do to avoid writing to disk and reading it again via file().
Thanks in advance.
I suspect you may be optimising prematurely here.
Most modern systems will cache files in memory for a significant period of time before they flush them to disk, so if you write the data to a temporary file, read it back in, then close and delete the file you may find that there's no significant disc traffic (unless it really is 100MB).
You might want to look at using tempfile.TemporaryFile() which creates a temporary file that is automatically deleted when closed, or else tempfile.SpooledTemporaryFile() which explicitly holds it all in memory until it exceeds a particular size.
Inexpensive ways to add seek to a filetype object