Hi,
I would like to know how to reply the content of a binary file using the
notebook-http mode from Jupyter Kernel Gateway.
For example, I want to publish a HTTP service that returns the PDF file. In the
Python notebook, if I try to use *print(content), *Python adds a 'b' prefix
that breaks the file (a browser can't read)
# GET /pdf
#In Python, I need to read it as binary
with open(fname_pdf, 'rb') as f:
content = f.read()
#The problem is here, Python adds 'b' prefix and this can't be processed by the
browser.
print(content)
# ResponseInfo GET /pdf
print(json.dumps({
'headers' : {
'Content-Type' : 'application/pdf'
}
})
)
Regards,
Eduardo
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/2f1cc086-0573-40f5-8aed-3d41c88ef9ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.