Login as the bot account "octogrid", if user isn't authenticated on Plotly
193781
def login_as_bot():
	

	plotly_credentials_file = join(
    	join(expanduser('~'), PLOTLY_DIRECTORY), PLOTLY_CREDENTIALS_FILENAME)

	if isfile(plotly_credentials_file):
		with open(plotly_credentials_file, 'r') as f:
			credentials = loads(f.read())

		if (credentials['username'] == '' or credentials['api_key'] == ''):
			plotly.sign_in(BOT_USERNAME, BOT_API_KEY)
	else:
		plotly.sign_in(BOT_USERNAME, BOT_API_KEY)
987097
def login_not_required(func):
    

    @functools.wraps(func)
    def decorated_view(*args, **kwargs):
        return func(*args, **kwargs)

    return decorated_view
279609
def _login(self):
        """"""
        self._sendAction("login", (
            ("Username", self._amiuser),
            ("Secret", self._amipass),
            ("Events", "off"),
        ))
        resp = self._getResponse()
        if resp.get("Response") == "Success":
            return True
        else:
            raise Exception("Authentication to Asterisk Manager Interface Failed.")
462705
function loginToAws(region, accountId, username, password) {
    const commandLine = `docker login --username AWS --password ${password} https://${accountId}.dkr.ecr.${region}.amazonaws.com`;
    return new Promise(
        (resolve, reject) =>
            command(commandLine, (err, stdout) => {
                if (err) {
                    reject(err);
                }
                resolve(stdout);
            }),
        { silent: true }
    );
}
1053756
def authenticated(self, environ, username=None, password=None, **params):
        ''''''
        if username != self.username:
            return False
        o = self.options
        qop = o.get('qop')
        method = environ['REQUEST_METHOD']
        uri = environ.get('PATH_INFO', '')
        ha1 = self.ha1(o['realm'], password)
        ha2 = self.ha2(qop, method, uri)
        if qop is None:
            response = hexmd5(":".join((ha1, self.nonce, ha2)))
        elif qop == 'auth' or qop == 'auth-int':
            response = hexmd5(":".join((ha1, o['nonce'], o['nc'],
                                        o['cnonce'], qop, ha2)))
        else:
            raise ValueError("qop value are wrong")
        return o['response'] == response
426744
def user_logged_in(self, sender, request: AxesHttpRequest, user, **kwargs):  # pylint: disable=unused-argument
        

        username = user.get_username()
        credentials = get_credentials(username)
        client_str = get_client_str(username, request.axes_ip_address, request.axes_user_agent, request.axes_path_info)

        log.info('AXES: Successful login by %s.', client_str)

        if settings.AXES_RESET_ON_SUCCESS:
            cache_key = get_client_cache_key(request, credentials)
            failures_since_start = self.cache.get(cache_key, default=0)
            self.cache.delete(cache_key)
            log.info('AXES: Deleted %d failed login attempts by %s from cache.', failures_since_start, client_str)
78982
def login_required(obj):
    
    decorator = request_passes_test(lambda r, *args, **kwargs: r.user.is_authenticated())
    return wrap_object(obj, decorator)
378337
def login(self):
        
        # Request index to obtain initial cookies and look more human
        pg = self.getPage("http://www.neopets.com")
        
        form = pg.form(action="/login.phtml")
        form.update({'username': self.username, 'password': self.password})
        pg = form.submit()
		
        logging.getLogger("neolib.user").info("Login check", {'pg': pg})
        
        return self.username in pg.content
1277591
def go_offline(connected=None):
    
    from .auth import get_config_file
    if connected is None:
        try:
            connected=True if get_config_file()['offline_connected'] is None else get_config_file()['offline_connected']
        except:
            connected=True
    if run_from_ipython():
        try:
            py_offline.init_notebook_mode(connected)
        except TypeError:
            #For older versions of plotly
            py_offline.init_notebook_mode()
        py_offline.__PLOTLY_OFFLINE_INITIALIZED=True
131832
function(err, data) {

            if(!err) {

                me.loggedin = true;
                fn(err, data);

            } else {

                me.loggedin = false;
                fn({code:SMTPError.AUTHFAILED, message:"authorization failed", smtp:data});

            }
        }
1007777
def login(self, response):
        
        self._state_params['auth'] = response['auth']
        self._user_data = response['user']
        if not self.logged_in:
            raise ApiLoginFailure(response)
503100
def login_required(view):
    """"""

    @functools.wraps(view)
    def wrapped_view(**kwargs):
        if g.user is None:
            return redirect(url_for("auth.login"))

        return view(**kwargs)

    return wrapped_view
979358
def _login_request(self, username=None, secret=None):
        """"""
        url = 'http://' + self._host + '/login_sid.lua'
        params = {}
        if username:
            params['username'] = username
        if secret:
            params['response'] = secret

        plain = self._request(url, params)
        dom = xml.dom.minidom.parseString(plain)
        sid = get_text(dom.getElementsByTagName('SID')[0].childNodes)
        challenge = get_text(
            dom.getElementsByTagName('Challenge')[0].childNodes)

        return (sid, challenge)
779806
def login(self, username, password, application, application_url):
        """"""
        logger.debug(str((username, application, application_url)))
        method = self._anaconda_client_api.authenticate
        return self._create_worker(method, username, password, application,
                                   application_url)
125859
def login_required(function=None, message=None, login_url=None):
    
    actual_decorator = user_passes_test(
        lambda u: u.is_authenticated(),
        message=message,
        login_url=login_url
    )

    if function:
        return actual_decorator(function)
    return actual_decorator
871298
def given_i_am_logged_in(context, username):
    
    user = get_user_model().objects.get(username=username)
    context.apiClient.force_authenticate(user=user)
1191375
def github_authenticated(cls, func):
        
        def inner(func_cls, *args, **kwargs):
            if not cls._gh_module:
                logger.warning('PyGithub not installed, skipping Github auth procedures.')
            elif not func_cls._user:
                # authenticate user, possibly also creating authentication for future use
                login = kwargs['login'].encode(utils.defenc) if not six.PY3 else kwargs['login']
                func_cls._user = cls._get_github_user(login, kwargs['ui'])
                if func_cls._user is None:
                    msg = 'Github authentication failed, skipping Github command.'
                    logger.warning(msg)
                    return (False, msg)
                # create an ssh key for pushing if we don't have one
                if not cls._github_ssh_key_exists():
                    cls._github_create_ssh_key()
                # next, create ~/.ssh/config entry for the key, if system username != GH login
                if cls._ssh_key_needs_config_entry():
                    cls._create_ssh_config_entry()
            return func(func_cls, *args, **kwargs)

        return inner