Skip to content

Commit af00da7

Browse files
authored
Create local_attachment.py
I had trouble figuring out the format for a local attachment, thought this may help someone else!
1 parent f028c06 commit af00da7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/local_attachment.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os
2+
import sys
3+
from webexteamssdk import WebexTeamsAPI, ApiError
4+
5+
cwd = os.path.abspath(os.path.dirname('.'))
6+
sys.path.append(cwd)
7+
testfile = '/'+cwd+'/test.png' #expected format: '//Users/userid/dir/test.png'
8+
9+
file_list = []
10+
file_list.append(testfile)
11+
12+
token = 'your_bot_token'
13+
api = WebexTeamsAPI(access_token=token)
14+
headers = {'Authorization': 'Bearer '+token}
15+
16+
api.messages.create(roomId='your_room_id', files=file_list)

0 commit comments

Comments
 (0)