2
by Aaron Bentley
Add skeleton grackle-put-message. |
1 |
#!/usr/bin/env python
|
2 |
import sys |
|
3 |
from grackle import client |
|
4 |
||
5 |
class UserError(Exception): |
|
6 |
"""An error caused by a user mistake."""
|
|
7 |
||
8 |
def main(*args): |
|
6.1.19
by Aaron Bentley
Fix grackle-put-message. |
9 |
if len(args) != 2: |
2
by Aaron Bentley
Add skeleton grackle-put-message. |
10 |
raise UserError("Wrong number of arguments supplied.") |
6.1.19
by Aaron Bentley
Fix grackle-put-message. |
11 |
grackle = client.GrackleClient('localhost', 8123) |
12 |
grackle.put_message(args[0], args[1], sys.stdin) |
|
2
by Aaron Bentley
Add skeleton grackle-put-message. |
13 |
|
14 |
||
15 |
if __name__ == '__main__': |
|
16 |
try: |
|
17 |
main(*sys.argv[1:]) |
|
18 |
sys.exit(0) |
|
19 |
except UserError, e: |
|
20 |
sys.stderr.write(str(e) + '\n') |
|
21 |
sys.exit(1) |