コード例 #1
0
def send_msg(account, token_id, msg):
    username, password, cookies = account[0][0], account[0][1], account[1]
    login = Login(username, password)
    login.initialize(cookies)
    if not login.islogin():
        login.login()
        if login.send_message(token_id, msg):
            print 'send ok!'
    if login.send_message(token_id, msg):
        print 'send ok!'
コード例 #2
0
ファイル: oauth.py プロジェクト: zbhknight/userauth
    def get(self, provider):
        if 'code' not in request.args:
            return flask.redirect('/oauth/redirect?provider=%s' % provider)

        auth_code = request.args.get('code')
        authflow = getAuthflow(provider)

        try:
            credential = authflow.step2_exchange(auth_code)
        except Exception as e:
            response = dict(
                    status="fail",
                    message=str(e))
            return make_response(jsonify(response)), 500

        if credential and 'email' in credential.id_token:
            email = credential.id_token['email']
        else:
            return flask.redirect('/oauth/redirect?provider=%s' % provider)

        _user = authService.get_user(email)
        if _user['id'] and _user['provider'] != provider:
            response = dict(
                    status="fail",
                    message="User exists")
            return make_response(jsonify(response)), 401

        if not _user:
            authService.create_user(email, 'defaultpassword', provider)
        _user = authService.get_user(email)
        response = Login.setLoginResponse(_user)
        return make_response(jsonify(response)), 200
コード例 #3
0
ファイル: app.py プロジェクト: jcarter62/abbui
def user_login(username='', password='') -> str:
    from auth import Login
    result = ''
    login = Login(username=username, password=password)
    if login.token > '':
        result = login.token
    return result
コード例 #4
0
def send_msg(account, token_id, msg):
    username, password, cookies = account[0][0], account[0][1], account[1]
    login = Login(username, password)
    login.initialize(cookies)
    if not login.islogin():
        login.login()
        if login.send_message(token_id, msg):
            print 'send ok!'
    if login.send_message(token_id, msg):
        print 'send ok!'
コード例 #5
0
def login_accounts():
    # read and login, save cookies.获得一组登陆账户
    accounts = get_accounts()
    if len(accounts) == 0:
        Logging.error(u'读取账户失败,请检查表格文件.')
    print accounts
    login_accounts = list()
    count = 0
    for account in accounts[:35]:
        cookies = 'cookies' + str(count)
        login = Login(account[0], account[1])
        login.initialize(cookies)
        if not login.login():
            import os
            os.remove('captcha.gif')
            Logging.error(u'账户{}登陆失败,请检查账户和密码')
            continue
        login_accounts.append((account, cookies))
        count += 1
    # print 'login accounts are: {}'.format(str(login_accounts))
    # 随机获取登陆账户并发送消息
    return login_accounts
コード例 #6
0
def login_accounts():
    # read and login, save cookies.获得一组登陆账户
    accounts = get_accounts()
    if len(accounts) == 0:
        Logging.error(u'读取账户失败,请检查表格文件.')
    print accounts
    login_accounts = list()
    count = 0
    for account in accounts[:35]:
        cookies = 'cookies'+str(count)
        login = Login(account[0], account[1])
        login.initialize(cookies)
        if not login.login():
            import os
            os.remove('captcha.gif')
            Logging.error(u'账户{}登陆失败,请检查账户和密码')
            continue
        login_accounts.append((account, cookies))
        count += 1
    # print 'login accounts are: {}'.format(str(login_accounts))
    # 随机获取登陆账户并发送消息
    return login_accounts
コード例 #7
0
import sys
from auth import Login
from server_api import ServerAPI
from PyQt5.QtWidgets import QApplication
from window_manager import WindowsManager

app = QApplication(sys.argv)
wm = WindowsManager()
wm.add("db", ServerAPI())
ex = Login(wm)
sys.exit(app.exec_())