I have a blank pdf file.i get some content in bytes and wrote in this pdf file. Again i got some bytes and i want to append it in existing pdf file. I tried to open pdf file in 'ab' and 'a+b' mode but content is not appending its overwriting . Please help me to achieve this.
Here is the code -
get_view_pdf_url = "http://localhost:8000/api/3.0/sites/a18ab9c9-c523-4848-9199-8c50e100ac36/views/e948dd8c-31b1-480a-8123-fecf47b1c682/pdf"
reqPDF = requests.get(get_view_pdf_url, data=b'', headers={'x-tableau-auth': token})
reqPDF.raise_for_status()
print((reqPDF.content))
filename = "C:/Users/pinki.sharma/Desktop/Work/tempmon/pinkiTest.pdf"
with open(filename, 'wb') as f:
f.write(reqPDF.content)
f.close()
get_view_pdf1_url = "http://localhost:8000/api/3.0/sites/a18ab9c9-c523-4848-9199-8c50e100ac36/views/910d1215-59cb-4d63-95fd-7a2b224f18bc/pdf"
reqPDF1 = requests.get(get_view_pdf1_url, data=b'', headers={'x-tableau-auth': token})
reqPDF1.raise_for_status()
print((reqPDF1.content))
with open(filename, 'a+b') as f1:
f1.write(reqPDF1.content)
f1.close()