Beispiel #1
0
 def get_context(self):
     users = list_users(current_user.key)
     return {
         'preselect':
         request.args.get('req_id'),
         'users': [{
             'id':
             user[0],
             'req_id':
             user[1],
             'name':
             user[2],
             'valid_from':
             user[4].astimezone(settings.TIMEZONE)
             if user[4] is not None else None,
             'valid_to':
             user[5].astimezone(settings.TIMEZONE)
             if user[5] is not None else None,
             'token_validity_time':
             user[6],
             'active':
             user[7],
             'usermod':
             user[8],
             'has_access':
             user[9],
         } for user in users]
     }
Beispiel #2
0
def check_user_is_active(username, list_users, query_user_last_seen):
    known_users = list_users()
    for i in known_users:
        if username == i[0]:
            last_seen = query_user_last_seen(username)
            if dt.now() - last_seen <= timedelta(days=180):
                print("Your account is confimed. Your account is valid till " +
                      str(date.today() + timedelta(days=180)))
            elif dt.now() - last_seen >= timedelta(days=180):
                print("You need to confirm your login")
        elif (not i in known_users):
            print("Hi, new user")
Beispiel #3
0
import time
from db import list_users
from db import query_user_last_seen, list_users
from datetime import datetime as dt, timedelta

registered_users = list_users()
date = dt.now()


def if_exist(user_name):
    i = 0
    while i < len(registered_users):
        username = registered_users[i][0]
        if username == user_name:
            return True
        i -= -1
    return False


user_email = ''
user_login = ''
attemps = 3


def login():
    user_email = input("Enter email: ")
    user_login = user_email.split("@")[0].lower()
    attemps = 3
    while if_exist(user_login) != 1 and attemps > 0:
        print("User " + user_login + " dont exist. Please retype your email!")
        user_email = input(str(attemps) + "| " + "Enter email: ")
Beispiel #4
0
        'channels': ['#exercise'],
    }

    response = requests.post("https://slack.com/api/files.upload",
                             params=payload,
                             files=file_to_upload)

    if response.status_code != 200:
        print(response.status_code)
        print(response.content)
    else:
        print('Uploade succeeded.')


fig = go.Figure()
users = list_users()
for user in users:
    timestamps, avg_times = [], []
    records = load_user_records(user)
    for r in records:
        total = r['correct'] + r['wrong']
        avg_time = float(r['duration']) / float(total)
        timestamps.append(r['timestamp'])
        avg_times.append(avg_time)

    fig.add_trace(
        go.Scatter(x=timestamps, y=avg_times, mode='lines', name=user))

fig.update_layout(title='Average Time Spent on Each Problem',
                  yaxis_title='Time (Seconds)')
Beispiel #5
0
from db import list_users

registered_users = list_users()
i = 0
while i < len(registered_users):
    username = registered_users[i][0]
    last_seen = registered_users[i][1]
    print(i + 1, username, last_seen.date)
    i = i + 1

from db import query_user_last_seen, list_users

existing_username = list_users()[0][0]
last_seen = query_user_last_seen(existing_username)
print("Пользователь", existing_username, "последний раз заходил", last_seen)
print("Пользователь shrimp", existing_username, "последний раз заходил",
      query_user_last_seen("shrimp"))

email = input("Введите e-mail ")
age = input("Введите ваш год рождения: ")

from auth import make_username

user = make_username('asASdASDsd@asdasd')
print(user)

from datetime import datetime as dt

print(dt.now())
# import datetime
# print(datetime.datetime.now())