I am successfully sending messages to pushover using the below code, however I would like to send picture attachment as introduced in the latest API. How am I able to convert the last code sample to work in python.
Working Code:
import httplib, urllib
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": "APP_TOKEN",
"user": "USER_KEY",
"message": "hello world",
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
Sample API
curl -s \
--form-string "token=APP_TOKEN" \
--form-string "user=USER_KEY" \
--form-string "message=here is an image attachment" \
-F "attachment=@/path/to/your/image.jpg" \
https://api.pushover.net/1/messages.json