Created
March 5, 2013 10:28
-
-
Save abhinavlal/5089348 to your computer and use it in GitHub Desktop.
Requests send multiple file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebOb==1.2.3 | |
argparse==1.2.1 | |
requests==0.7.5 | |
wsgiref==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from webob.multidict import MultiDict | |
r = requests.post( | |
"https://api.mailgun.net/v2/excited.net/messages", | |
auth=("api", "YOUR API KEY"), | |
files=MultiDict([("attachment", open("a.txt")), | |
("attachment", open("b.txt"))]), | |
data={"from": "Excited User <[email protected]>", | |
"to": "[email protected]", | |
"subject": "Hello", | |
"text": "Testing some Mailgun awesomness!", | |
"html": "<html>HTML version of the body</html>"}) | |
print r.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment