forked from metafisica/yowdaemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.py
More file actions
executable file
·25 lines (23 loc) · 766 Bytes
/
send.py
File metadata and controls
executable file
·25 lines (23 loc) · 766 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
#!/usr/bin/env python
from yowsup.demos import sendclient
from yowsup import env
import sys,time,os
import logging
logging.basicConfig(level=logging.ERROR)
if len(sys.argv)!=3:
print ('Usage: %s phone_number message' %sys.argv[0])
sys.exit(0)
with open(os.path.dirname(os.path.realpath(sys.argv[0]))+'/config.cfg') as f:
for line in f:
if line.find('phone number:',0)==0:
phone=line[13:]
phone=phone.strip()
elif line.find('password:',0)==0:
passwd=line[9:].strip()
credentials=(phone,passwd)
try:
stack = sendclient.YowsupSendStack(credentials, [([sys.argv[1], sys.argv[2]])],False)
stack.start()
except KeyboardInterrupt:
print ('Message delivered, did it arrive?')
sys.exit(0)