Purchase invoice pdf from api

Good morning, i’m using python frappe client to manage erp next documents, now i need to get hte PDF file of a purchase invoice from the server, i can get it using the url

http://server/api/method/frappe.utils.print_format.download_pdf?doctype=Purchase%20Invoice&name=PINV-00001&format=Standard&no_letterhead=0&_lang=en

but i need to separately log in and use cookies to do this request.
Can i get the purchase invoice PDF using api?

Thank you