forked from jcfigueiredo/XMPP-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtalk.py
executable file
·37 lines (27 loc) · 810 Bytes
/
gtalk.py
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
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
Usage: gtalk.py [email protected] "Message"
Requirement
xmpppy/python-xmpp - Python library for communication with XMPP (Jabber) servers
'''
from init_env import USERNAME, PASSWORD, SERVER, PORT
import xmpp
import sys
HELP = 'Usage: gtalk.py [email protected] "Message"'
def main():
if len(sys.argv) < 3:
print HELP
sys.exit(0)
client = 'underworld'
cnx = xmpp.Client(SERVER, debug=[])
# cnx = xmpp.Client('gmail.com')
conres = cnx.connect(server=(SERVER, PORT))
# print 'conres:', conres
# cnx.auth(USERNAME, PASSWORD, 'python')
cnx.auth(USERNAME, PASSWORD)
send_to = sys.argv[1]
msg_text = sys.argv[2]
cnx.send(xmpp.Message(send_to, msg_text))
if __name__ == '__main__':
main()