Commit fe4980bb authored by Lysander Trischler's avatar Lysander Trischler

Let sport.py use API password

parent fcf35d94
......@@ -3,6 +3,7 @@
if __name__ == "__main__":
import sys
import os.path
import getpass
import datetime
import functools
......@@ -12,8 +13,18 @@ if __name__ == "__main__":
import tornado.escape
import tornado.options
def passwd():
filename = "passwd"
if os.path.exists(filename):
try:
with open(filename, "r") as f:
return f.readline().replace("\r", "").replace("\n", "")
except Exception as e:
sys.stderr.write("cat(%s): %r\n" % (filename, e))
return None
tornado.options.define("username", type=str, default=getpass.getuser())
tornado.options.define("password", type=str, default=None)
tornado.options.define("password", type=str, default=passwd())
tornado.options.define("discipline", type=str, default=None)
tornado.options.define("count", type=int, default=20)
tornado.options.define("start", type=str, default=None)
......@@ -34,7 +45,6 @@ if __name__ == "__main__":
@cached
def get_url():
return tornado.options.options.url
#return "http://localhost:8888/api/exercises",
@cached
def get_username():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment