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


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