-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhey.py
More file actions
29 lines (24 loc) · 713 Bytes
/
Copy pathhey.py
File metadata and controls
29 lines (24 loc) · 713 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
# User facing application to send messages
__author__ = 'Saurabh Bhatia'
# import statements
import sys
import xmlrpclib
def main():
if not len(sys.argv) > 1:
print("Enter at-least one recipient")
sys.exit(1)
toList = sys.argv[1:]
# get the RPC server
s = xmlrpclib.ServerProxy('http://localhost:9000', allow_none=True)
# get the message
print('Type message, Hit Ctrl+D when done')
try:
msgText = ''.join(sys.stdin.readlines())
except KeyboardInterrupt:
print('\nMessage aborted...')
sys.exit(1)
else:
print('\nAttempting to send message')
s.send2server(toList, msgText)
if __name__ == '__main__':
main()