Beispiel #1
0
def send_users(msg_id, users):
    """
    Send a list of users a message.
    """
    r.set("msg:%s:count" % msg_id, len(users))
    for username in users:
        user.send(username, msg_id)
Beispiel #2
0
def send_users(msg_id, users):
    """
    Send a list of users a message.
    """
    r.set("msg:%s:count" % msg_id, len(users))
    for username in users:
        user.send(username, msg_id)
Beispiel #3
0
 def send_users(self, users):
     """
     Send a list of users the message.
     """
     r.set("%s:count" % self.key, len(users))
     for username in users:
         user = User(username)
         user.load()
         user.send(self.id)
Beispiel #4
0
 def send_users(self, users):
     """
     Send a list of users the message.
     """
     r.set("%s:count" % self.key, len(users))
     for username in users:
         user = User(username)
         user.load()
         user.send(self.id)
Beispiel #5
0
def flushdb():
    """
    Prepare the database to store users.
    """
    r.set("message_last_id", 0)
Beispiel #6
0
def flushdb():
    r.set("msg_counter", 0)
Beispiel #7
0
def flushdb():
    """
    Prepare the database to store users.
    """
    r.set("message_last_id", 0)    
Beispiel #8
0
def flushdb():
    r.set("msg_counter", 0)
Beispiel #9
0
def signJWT(user_id: int, role: str):
    payload = {"id": user_id, "role": role}
    token = jwt.encode(payload, JWT_SECRET, algorithm=JWT_ALGORITHM)
    r.set(token, user_id)
    return token