with tempfile.NamedTemporaryFile() as pdf_contents:
    pdf_contents.file.write(pdf)
file_url = urlparse.urljoin('file:', urllib.request.pathname2url(pdf_contents.name))
document = Poppler.Document.new_from_file(file_url, None)
How to display a pdf that has been downloaded in python