forked from andrewzeneski/retwis-pytor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrcli.py
executable file
·58 lines (44 loc) · 1.21 KB
/
rcli.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
import urllib2
import json
import os
import sys
# ------------------------------- TYPER HERE YOUR HASCODE ----------------------------------
HASHCODE = ''
# ------------------------------------------------------------------------------------------
try:
from keys import HASHCODE
except ImportError:
pass
if len(sys.argv) < 2:
print """\
Usage: ./rcli.py Some text
"""
sys.exit(0)
status = sys.argv[1:]
status = ' '.join(status)
jdata = json.dumps({"hash": HASHCODE, "status": status})
f = urllib2.urlopen("http://ci.local/api/message", jdata)
print f.read()
"""
HOME_DIR = os.getenv("HOME")
path = HOME_DIR + '/.retwis'
if not os.path.exists():
f = open(path, 'w')
f.write('')
f.close()
for line in open(path):
if line.startswith('login='):
login = line[6:]
elif line.startswith('hash='):
hash = line[5:]
if not login or not hash:
login = raw_input('Login:')
password = raw_input('Password:')
# Now go and register
# Whatever structure you need to send goes here:
hash = '57132716327467367173128543205886802271'
jdata = json.dumps({"hash": hash, "status": status})
f = urllib2.urlopen("http://127.0.0.1:80/api/message", jdata)
print f.read()
"""