Is there a way to attach a pdf files to the anvil using amilgun?

I’m trying to create a method in my software to send emails with a PDF generated using the PDFRender function from Anvil to the users who requested it, but it’s not working at all because I can’t attach the PDF to the email as files or attachments. Do you know what could help me?

I have already tried several functions and codes that I found online while searching for someone who had the same question, but I couldn’t find anything that works…

Code Sample:

...
pdf = PDFRenderer(filename= (name_for_pdf.replace(" ","_")).replace("/","_") + ".pdf", page_size='A4', quality= 'printer').render_form('pdf_maker' ,name = nome_for_pdf)....
....
    resp = anvil.http.request(
		  url= "https://api.mailgun.net/v3/s(notshowingmykey).mailgun.org/messages",
		  username ="api",
      password= "(notshowingmykey)",
		  data={"from": "App <postmaster@(notshowingmymailgunemail).mailgun.org>",
			"to": "user <"+(email_user)+">",
			"subject": "Results " +  f"({data_time_now})",
			"text": "this is a test"},
      files=[("attachment", (pdf))])
     

Clone link:
share a copy of your app