def test_already_logged_in(logged_out_bot): """ Test logging in when already logged in. """ log_in(logged_out_bot.username, BOT_PASSWORD) expect_error(log_in, InputError, logged_out_bot.username, BOT_PASSWORD)
def login(): if 'token' in session: return "Already logged in!" req = request.get_json() email = req['email'] password = req['password'] try: token = log_in(email, password)['access_token'] payload = verify_decode_jwt(token) id = payload["sub"][6:] trader = Trader.query.get(id) if not trader: trader = Trader(id=id, name="Test Account", email=email, cash=10000) trader.insert() session['token'] = token stocks = Possession.query.filter(Possession.trader_id == id) except: abort(403) message = f''' Hello {trader.name}! You have {trader.cash} dollars in your account. ''' for stock in stocks: message = message + f"You have {stock.position} shares of {stock.stock_code}.\n" db.session.close() return message
def test_success(logged_out_bot): """ Test a successful login """ assert log_in(logged_out_bot.username, BOT_PASSWORD) == None # Check if data was updated assert data.users.get(logged_out_bot.username) == logged_out_bot
def sign_in(): try: username = request.args.get('user') password = request.args.get('pass') return auth.log_in(username, password) except: return jsonify(success=False, reason='Could not sign in due to a Server Error')
def login(): wwn('Testing login.. ') try: r = auth.log_in(settings.servers['master']) if not r.verify: p_fail('Login test failed!') else: p_ok('Login succeeded') except: p_fail('Login test failed!')
def login(): if request.method == 'POST': #req_data = request.get_json() req_data = {"email" : "*****@*****.**", "password" : "reeeee"} # Again do stuff with the info passed in try: result = log_in(req_data["email"], req_data["password"]) except Exception as e: print(e) return json.dumps({"error_message": e}) return json.dumps({"message": "Loggin in!"}) # This may not even be the way to do it but we will figure it out if request.method == 'GET': return """<h1> Fields are email and password </h1>"""
def get_users(server): s = auth.log_in(server) r = s.get(server['url'] + '/temp_service.php?action=users_for_machine&machine_id=1') #r = s.get(server['url'] + '/services/users/user') return r
def init_client(self): """Sets ImgurClient scope based on user preference""" self.client = get_anon_client() if self.args.user: self.client = log_in(self.client)
s = requests.session() discorddiscord = Presence("720066058051911701", pipe=0, loop=None, handler=None) if getattr(sys, 'frozen', False): app_path = os.path.dirname(sys.executable) elif __file__: app_path = os.path.dirname(__file__) config_path = os.path.join(app_path, "config.txt") config_file = open(config_path, "r+") config_data = json.load(config_file) if config_data["session_token"] == "": loginsession = auth.log_in("1.0.0") config_data["session_token"] = loginsession config_file.seek(0) json.dump(config_data, config_file) config_file.truncate() tokenn = auth.get_cookie(config_data["session_token"], "en-US", "1") config_file.close() print(tokenn) cookies = '_dnt=0; _ga=GA1.2.557708532.1591733570; _gid=GA1.2.2125084658.1591733570; _gtoken=' + str( tokenn) + ";" uheaders = { 'Host': 'web.sd.lp1.acbaa.srv.nintendo.net', 'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'User-Agent':
def log_in(): return auth.log_in(request, db, app.config['SECRET_KEY'])