Beispiel #1
0
 def login(self, username, password):
     username = Binary(username.encode("utf-8"))
     password = Binary(password.encode("utf-8"))
     try:
         r = self.client.login(username, password)
         self.logged_in = r["result"]
     except Error as e:
         print("ERROR:", e)
         self.logged_in = False
Beispiel #2
0
 def new_topic(self, board, subject, msg):
     if not self.logged_in:
         raise Exception("You must be logged in to do that!")
     subject = Binary(subject.encode("utf-8"))
     msg = Binary(msg.encode("utf-8"))
     try:
         r = self.client.new_topic(board, subject, msg)
         return "http://yourewinner.com/index.php?topic={}.0".format(r["topic_id"])
     except Error as e:
         print("ERROR:", e)