-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendImage.py
More file actions
30 lines (27 loc) · 890 Bytes
/
sendImage.py
File metadata and controls
30 lines (27 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import requests
import json
def sendAttachmentImage(url1):
url="http://api.flock.co/v1/chat.sendMessage"
d={
"name":"Orient",
"profileImage":"http://i.imgur.com/pAKIUxV.jpg"
}
widgetdict={"original": { "src": url1, "width": 400, "height": 400 }}
viewdict={"image":widgetdict}
attachmentarrdict={"title":"","description":"","views":viewdict}
print (attachmentarrdict)
payload={
"to":"u:mgmjkx1mjww22dx1",
"token":"ba0af222-e3b0-4686-b2d7-ea9fa7839cc9",
"attachments" :json.dumps([attachmentarrdict])
}
headers={
"Content-Type":"application/x-www-form-urlencoded",
"Content-Length":"70"
}
r=requests.post(url,data=payload,headers=headers)
print (r)
print (r.text)
sendAttachmentImage("http://i.imgur.com/lR542bC.jpg")
sendAttachmentImage("http://i.imgur.com/nyVcvDD.jpg")
sendAttachmentImage("http://i.imgur.com/0wzMzbb.jpg")