From ebb893289cc3d0f9979a2ca5c8ccac858c1a175d Mon Sep 17 00:00:00 2001 From: PanFritz Date: Fri, 11 Sep 2015 11:39:06 +0200 Subject: Converted to use async_query --- check.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'check.py') diff --git a/check.py b/check.py index 8bbfdeb..cd13a6b 100644 --- a/check.py +++ b/check.py @@ -31,14 +31,11 @@ def get_last_seen(player): # receive link and email from website -def get_website_data(player): - conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver") - curs = conn.cursor() +def get_webite_data(player): uuid = str(uid(player)).replace("-", "") - curs.execute("SELECT DISTINCT `id`, `email` FROM users WHERE `uuid` = ? LIMIT 1", (uuid,)) - results = curs.fetchall() - curs.close() - conn.close() + async_query(mysql_database,"SELECT DISTINCT `id`, `email` FROM users WHERE `uuid` = ? LIMIT 1",(uuid,),get_website_data_target) + +def get_website_data_target(results): return ("http://redstoner.com/users/%s" % results[0][0], results[0][1]) if results else (None, None) -- cgit v1.2.3