Commit ac1ccff1 by Juan Pablo

anda aparentemente

1 parent 3d5a9743
...@@ -198,7 +198,7 @@ class Mail(ServiceBase): ...@@ -198,7 +198,7 @@ class Mail(ServiceBase):
"content": [{"type": "text/plain", "value": str(msg["Body"])}]} "content": [{"type": "text/plain", "value": str(msg["Body"])}]}
if not len(msg["Adjuntos"]) == 0: if not len(msg["Adjuntos"]) == 0:
data["attachments"] = msg["Adjuntos"] data["attachments"] = msg["Adjuntos"]
import ipdb; ipdb.set_trace() #import ipdb; ipdb.set_trace()
r = requests.post(url="https://api.sendgrid.com/v3/mail/send",data=json.dumps(data), headers=headers ) r = requests.post(url="https://api.sendgrid.com/v3/mail/send",data=json.dumps(data), headers=headers )
#print(r.text) #print(r.text)
return(msg["succ"]) return(msg["succ"])
...@@ -220,10 +220,10 @@ class Mail(ServiceBase): ...@@ -220,10 +220,10 @@ class Mail(ServiceBase):
msg["Body"] = objeto.read() msg["Body"] = objeto.read()
objeto.close() objeto.close()
else: else:
with open('attachment.pdf', 'rb') as f: with open(filepath, 'rb') as f:
contenido = f.read() contenido = f.read()
f.close() f.close()
adj = {"content": base64.b64encode(data).decode(), adj = {"content": base64.b64encode(contenido).decode(),
"filename": file, "filename": file,
"disposition": "attachment", "disposition": "attachment",
"type": "application/pdf"} "type": "application/pdf"}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!