Ejemplo n.º 1
0
    def add_point(self, username: str) -> str:
        """
        Register point.

        Args:
            username (str): Point username.

        Return:
            str: Authstr.
        """
        if not self.search_point(username):
            authstr = Base.generate_authstr(username)
            open(self.path + "points.txt",
                 "a").write("{}:{}\n".format(username, authstr))
            return authstr
        return ""
Ejemplo n.º 2
0
    def add_point(self, username: str) -> str:
        """
        Register point.

        Args:
            username (str): Point username.

        Return:
            str: Authstr.
        """
        if not self.search_point(username):
            connection, cursor = self.__connect()
            authstr = Base.generate_authstr(username)
            sql = "INSERT INTO points (username, authstr) VALUES (?, ?);"
            cursor.execute(sql, (username, authstr))
            connection.commit()
            connection.close()
            return authstr
        return ""