I have a JSON response that looks like:
{u'AllowExistingAttachmentToBeOverwritten': False,
u'Name': u'Go-Daddy.pdf',
u'AttachmentData': u'JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9DcmVhdG9yIChNb3ppbGxhLzUuMCBcKFdpbmR...
u'ItemIdAttachedTo': 91198711,
u'Description': u''}
How do I convert it to a PDF file?
I tried:
with open(fileName, 'wb') as f:
f.write(result['AttachmentData'])
f.close()
also tried:
with open(fileName, 'wb') as f:
f.write(result['AttachmentData'].encode())
f.close()
but in both cases the file were created but Adobe could not open the file.