Exemple #1
0
class JoinForm(FlaskForm):
    username = StringField(
        'Username',
        validators=[
            NoneOf(get_users(),
                   message=
                   "This username is already in use, please pick another one")
        ])
    password = PasswordField(
        'Password',
        validators=[
            Length(min=8,
                   message=
                   "Please make sure your password has eight letters or more")
        ])
    learner_name = StringField('Learner Name', validators=[DataRequired()])
    email = StringField(
        'Email',
        validators=[
            Email(),
            NoneOf(
                get_user_emails(),
                message=
                "This email address is already in use, please check you are not already a member"
            )
        ])
    submit = SubmitField(label='Register')
Exemple #2
0
def edit_account(user_id):
    """
    User editing
    :param user_id: user_id for editing
    :return: domain accounts list page
    """
    users = []

    for d in config.DOMAIN_KEY:
        domain_data = config.DOMAIN_KEY[d]
        this_domain_users = get_users(domain_data[1], domain_data[0])
        users.extend(this_domain_users)
    account, domain, domain_data = find_user_in_lists(user_id, users)
    form = EditUser()
    form.user_id.data = account[0]

    if form.validate_on_submit():
        resp = edit_user(form.user_id.data, form.name.data, form.sname.data,
                         form.enabled.data, domain_data[1], domain_data[0])
        console_output(resp, 'User editing')
        return redirect('/mails/{}'.format(domain))

    form.name.data = account[2]
    form.sname.data = account[3]
    form.enabled.data = account[4]
    return render_template('edit_user.html',
                           title='Edit user',
                           form=form,
                           companies=companies,
                           user=account[1])
Exemple #3
0
def generate_users():
    count = parse_count(request.args.get('count', '100'))

    if type(count) is str:
        return count

    return get_users(count)
Exemple #4
0
def domain_accounts(domain):
    """
    List accounts on domain
    :param domain: domain for listing
    :return: domain accounts list page
    """
    domain_data = config.DOMAIN_KEY[domain]
    users = get_users(domain_data[1], domain_data[0])
    return render_template('mails.html',
                           title='{} users'.format(domain),
                           users=users,
                           domain=domain,
                           companies=companies)
Exemple #5
0
def all_accounts():
    """
    List all accounts on all domains
    :return: accounts list page
    """
    users = []
    for d in config.DOMAIN_KEY:
        domain_data = config.DOMAIN_KEY[d]
        this_domain_users = get_users(domain_data[1], domain_data[0])
        users.extend(this_domain_users)
    return render_template('mails.html',
                           title='Users',
                           users=users,
                           domain='all',
                           companies=companies)
Exemple #6
0
def api_chicago_users():
    months = json.loads(request.args.get('months'))
    months = list(map(int, months))
    days = json.loads(request.args.get('days'))
    days = list(map(int, days))

    # Start and End slicing args of the get get_users function
    start = int(json.loads(request.args.get('start')))
    end = int(json.loads(request.args.get('end')))

    df = fn.get_df('chicago', months, days)
    users = fn.get_users(df, start, end).to_json(orient='index')

    # Parsing users data as json object
    parsed_users = json.loads(users)
    return parsed_users
Exemple #7
0
class LoginForm(FlaskForm):
    username = StringField(
        'Username',
        validators=[
            AnyOf(
                get_users(),
                message=
                "This username has not been recognised, please check it and try again"
            )
        ])
    password = PasswordField(
        'Password',
        validators=[
            Length(
                min=8,
                message="Your password would have had eight letters or more")
        ])
    submit = SubmitField(label='Login')
Exemple #8
0
                        total_time, mean_time, subscribers, customers, males,
                        females, first_birth, recent_birth, common_birth)

        print('\n' + '#' * 40)
        print("This took %s seconds." % (time.time() - start_time))
        print('#' * 40 + '\n')

        users_start = 0
        users_end = 5
        while True:
            desc_word = 'first' if users_start == 0 else 'next'
            show_user_data = fnc.get_simple_input(
                'Would you like to see the ' + desc_word +
                ' 5 rows of the data set? (Enter yes or no): \n')
            if show_user_data.lower() in ['yes', 'y']:
                users_data = fn.get_users(result_df, users_start,
                                          users_end).to_json(orient='index')
                parsed_users_data = json.loads(users_data)
                print(json.dumps(parsed_users_data, indent=4, sort_keys=True))
                users_start += 5
                users_end += 5

            else:
                break

        restart = fnc.get_simple_input(
            '\nWould you like to restart? (Enter yes or no): \n')
        if restart.lower() not in ['yes', 'y']:
            print('\nThanks for using this script.\nGoodbye!\n')
            break

except:
Exemple #9
0
from banner import banner
from functions import message_count, time_set, get_users


api_key = 'RuCaptcha Api Token'
TOKEN = "Kate Mobile Token"


vk = vk_api.VkApi(token=TOKEN, captcha_handler=captcha_handler).get_api()
console = Console()
console.print(banner, style='cyan')


timer = time_set()
message_num = message_count()
user_list = get_users(vk)


message = input('Введите сообщение для отправки: ')
tasks = [f'''Сообщения отправляются"{i[0]}"'''  for i in user_list]


with console.status("[bold green]Отсылаю сообщения...") as status:      
	for user in user_list:

		task = tasks.pop(0)
		time.sleep(timer)
		console.log(f"{task}")

		for _ in range(message_num):
			try: