Exemple #1
0
import base64

from mysqldb import Mysql
from influx import Influx
from addPlayer import addPlayer
from addMatches import addMatches
from createPieChart import createPieChart
from config import dbPlayersLayout
from dbCredentials import token, org, url, bucket, host, user, password, database

# --------------- ON START ACTIONS ---------------

app = dash.Dash(__name__, title='Faceit Stats')

# initialize database connections
db = Mysql(host=host, user=user, password=password, database=database)
influx = Influx(token=token, org=org, bucket=bucket, url=url)

# check if table 'players' exists
result = db.checkIfTableExists('players')
if not result:
    db.addTable(dbPlayersLayout)

# select all names from the 'players' table
players = db.select('players', None, 'name')

# ------------------ APP LAYOUT ------------------

app.layout = html.Div([
    html.H1("Analyze your Faceit CS:GO Statistics and compare it with others!",
            style={"color": "#fff"}),
def test_database():
    ''' Returns a MySql DB object '''
    return Mysql(host="localhost", user="******", password="******", database="faceit")
def test_for_update():
    mysqldb = Mysql("root", "123456", "test")
    success, msg = mysqldb.increaseMutex("user", {"uid": 1}, "status")
    if not success:
        print msg
    mysqldb.disconnet()
import random
import multiprocessing
from mysqldb import Mysql


def test_for_update():
    mysqldb = Mysql("root", "123456", "test")
    success, msg = mysqldb.increaseMutex("user", {"uid": 1}, "status")
    if not success:
        print msg
    mysqldb.disconnet()


if __name__ == "__main__":
    mysqldb = Mysql("root", "123456", "test")
    print mysqldb.get_one("user", {})
    import time

    # print mysqldb.update('user', {"status": 1}, {"nickname": "123", "sex": "f"})
    kjdflsakj
    start = 5
    s = "abcdefghijklmnopqrstuvwxyz"
    t = time.time()
    datas = []
    for i in range(10):
        _id = start + 1
        length = random.randrange(1, 20)
        nickname = []
        for i in range(length):
            nickname.append(random.choice(s))
Exemple #5
0
def test_database():
    ''' Returns a MySql DB object '''
    return Mysql(host=host, user=user, password=password, database=database)
Exemple #6
0
def test_error_database():
    ''' Returns a faulty MySql DB object '''
    return Mysql(host="these", user="******", password="******", database="wrong")