Streaming pdf with URLLib
Aahz
aahz at pythoncraft.com
Thu May 21 20:49:07 EDT 2009
In article <04eacd56-5293-4553-bdb3-ad2e8266c6b0 at z7g2000vbh.googlegroups.com>,
Scooter <slbentley at gmail.com> wrote:
>
>#!/usr/bin/python
>
>import urllib
>
>u = urllib.urlopen('https://myinternal.server/pdfs/pdfstreamer.aspx')
>print 'Content-type: application/pdf\n\n'
># print 'Content-type: application/x-msdownload; name=\"FileName\"\n
>\n'
># print 'Content-Dispostion: attachment; filename=\"FileName\"\r\n\n'
>
>pdfdoc = u.read()
>print pdfdoc
>
>Hitting my pdfstreamer.aspx app directly through a browser renders a
>pdf just fine. So now I'm attempting to use this python app on an
>external webserver, access it as a cgi, to pull the pdf, and then re-
>render it, but at that point it just shows me the raw pdf in
>the browser.
What application type does the browser report?
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"A foolish consistency is the hobgoblin of little minds, adored by little
statesmen and philosophers and divines." --Ralph Waldo Emerson
More information about the Python-list
mailing list