How should I base64 encode a PDF file for transport over XML-RPC in Python?
If you don't want to use the xmlrpclib's Binary class, you can just use the .encode() method of strings:
a = open("pdf_reference.pdf", "rb").read().encode("base64")