Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the Schemaverse Output Stream (SOS) client. Use this to easily …

…receive notify messages from the schemaverse system.
  • Loading branch information...
commit f6c4e5f79b833be127a144b7ea1e8f4837d5223b 1 parent da9d3ef
@Abstrct authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 clients/SchemaverseOutputStream/SchemaverseOutputStream.py
View
27 clients/SchemaverseOutputStream/SchemaverseOutputStream.py
@@ -0,0 +1,27 @@
+import select
+import psycopg2
+import psycopg2.extensions
+import getpass
+
+
+print "Schemaverse Output Stream (SOS) v1.0"
+Username = raw_input("Username: ")
+Password = getpass.getpass()
+Host = raw_input("Host: ")
+
+conn = psycopg2.connect("dbname='schemaverse' user='" + Username + "' host='"+Host+"' password='"+Password +"'")
+conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
+
+get_channel = conn.cursor()
+get_channel.execute("""SELECT get_player_error_channel();""")
+error_channel = get_channel.fetchone()
+
+curs = conn.cursor()
+curs.execute("LISTEN " + error_channel[0] + ";")
+print "Waiting for notifications on error channel '"+ error_channel[0] +"'"
+while 1:
+ if select.select([conn],[],[],5) != ([],[],[]):
+ conn.poll()
+ while conn.notifies:
+ notify = conn.notifies.pop()
+ print "[Error]", notify.payload
Please sign in to comment.
Something went wrong with that request. Please try again.