Search for login url from VK login page
503528
def get_base_url(html: str) -> str:
    
    forms = BeautifulSoup(html, 'html.parser').find_all('form')
    if not forms:
        raise VVKBaseUrlException('Form for login not found')
    elif len(forms) > 1:
        raise VVKBaseUrlException('More than one login form found')
    login_url = forms[0].get('action')
    if not login_url:
        raise VVKBaseUrlException('No action tag in form')
    return login_url
821955
public function getLoginUrl(array $scope = [], $callback_url = '')
    {
        $scope = $this->getScope($scope);
        $callback_url = $this->getCallbackUrl($callback_url);

        return $this->getRedirectLoginHelper()->getLoginUrl($callback_url, $scope);
    }
1064719
def get_entry_url(self, entry):
        
        # It could be possible this page is fetched as fallback, while the 'entry' does have a translation.
        # - Currently django-fluent-pages 1.0b3 `Page.objects.get_for_path()` assigns the language of retrieval
        #   as current object language. The page is not assigned a fallback language instead.
        # - With i18n_patterns() that would make strange URLs, such as '/en/blog/2016/05/dutch-entry-title/'
        # Hence, respect the entry language as starting point to make the language consistent.
        with switch_language(self, entry.get_current_language()):
            return self.get_absolute_url() + entry.get_relative_url()
568427
def async_login(self):
       """"""
       _LOGGER.debug('Attempting to log into Alarm.com...')

       # Get the session key for future logins.
       response = None
       try:
           with async_timeout.timeout(10, loop=self._loop):
               response = yield from self._websession.get(
                   self.ALARMDOTCOM_URL + '/default.aspx',
               headers={'User-Agent': 'Mozilla/5.0 '
                                      '(Windows NT 6.1;'
                                      ' WOW64; rv:40.0) '
                                      'Gecko/20100101 '
                                      'Firefox/40.1'})

           _LOGGER.debug(
               'Response status from Alarm.com: %s',
               response.status)
           text = yield from response.text()
           _LOGGER.debug(text)
           tree = BeautifulSoup(text, 'html.parser')
           self._login_info = {
               'sessionkey': self.SESSION_KEY_RE.match(
                   str(response.url)).groupdict()['sessionKey'],
               self.VIEWSTATE: tree.select(
                   '#{}'.format(self.VIEWSTATE))[0].attrs.get('value'),
               self.VIEWSTATEGENERATOR: tree.select(
                   '#{}'.format(self.VIEWSTATEGENERATOR))[0].attrs.get('value'),
               self.EVENTVALIDATION: tree.select(
                   '#{}'.format(self.EVENTVALIDATION))[0].attrs.get('value')
           }

           _LOGGER.debug(self._login_info)
           _LOGGER.info('Attempting login to Alarm.com')

       except (asyncio.TimeoutError, aiohttp.ClientError):
           _LOGGER.error('Can not get login page from Alarm.com')
           return False
       except AttributeError:
           _LOGGER.error('Unable to get sessionKey from Alarm.com')
           raise

        # Login params to pass during the post
       params = {
           self.USERNAME: self._username,
           self.PASSWORD: self._password,
           self.VIEWSTATE: self._login_info[self.VIEWSTATE],
           self.VIEWSTATEGENERATOR: self._login_info[self.VIEWSTATEGENERATOR],
           self.EVENTVALIDATION: self._login_info[self.EVENTVALIDATION]
       }

       try:
           # Make an attempt to log in.
           with async_timeout.timeout(10, loop=self._loop):
               response = yield from self._websession.post(
                   self.ALARMDOTCOM_URL + '{}/default.aspx'.format(
                       self._login_info['sessionkey']),
                   data=params,
                   headers={'User-Agent': 'Mozilla/5.0 '
                                          '(Windows NT 6.1; '
                                          'WOW64; rv:40.0) '
                                          'Gecko/20100101 '
                                          'Firefox/40.1'}
               )
           _LOGGER.debug(
               'Status from Alarm.com login %s', response.status)

           # Alarm.com changed their redirect so hit this page directly to get the status of login.
           with async_timeout.timeout(10, loop=self._loop):
               response = yield from self._websession.get(
                   self.ALARMDOTCOM_URL + '{}/main.aspx'.format(
                       self._login_info['sessionkey']),
                   headers={'User-Agent': 'Mozilla/5.0 '
                                          '(Windows NT 6.1; '
                                          'WOW64; rv:40.0) '
                                          'Gecko/20100101 '
                                          'Firefox/40.1'}
               )

           # Get the text from the login to ensure that we are logged in.
           text = yield from response.text()
           _LOGGER.debug(text)
           tree = BeautifulSoup(text, 'html.parser')
           try:
               self.state = tree.select(self.ALARM_STATE)[0].get_text()
               _LOGGER.debug(
                   'Current alarm state: %s', self.state)
               self.sensor_status = tree.select(self.SENSOR_STATUS)[0].get_text()
               _LOGGER.debug(
                   'Current sensor status: %s', self.sensor_status)
           except IndexError:
               try:
                   error_control = tree.select(
                       '#{}'.format(self.ERROR_CONTROL))[0].attrs.get('value')
                   if 'Login failure: Bad Credentials' in error_control:
                       _LOGGER.error(error_control)
                       return False
               except AttributeError:
                   _LOGGER.error('Error while trying to log into Alarm.com')
                   return False
       except (asyncio.TimeoutError, aiohttp.ClientError):
           _LOGGER.error("Can not load login page from Alarm.com")
           return False
1239485
def api_walk(uri, per_page=100, key="login"):
    
    page = 1
    result = []

    while True:
        response = get_json(uri + "?page=%d&per_page=%d" % (page, per_page))
        if len(response) == 0:
            break
        else:
            page += 1
            for r in response:
                if key == USER_LOGIN:
                    result.append(user_login(r))
                else:
                    result.append(r[key])

    return list(set(result))
953747
def get_url_with_auth(self, url) -> str:
        """"""
        if not self._username:
            return url

        url += '&user={:s}'.format(self._username)

        if not self._password:
            return url

        return url + '&pass={:s}'.format(self._password)
105441
def login_view(request):
    '''  '''
    ANONYMOUS_SESSION = request.session.get('ANONYMOUS_SESSION', False)
    page_name = "Login Page"
    redirect_to = request.GET.get('next', reverse('homepage'))
    if (request.user.is_authenticated() and not ANONYMOUS_SESSION) or (ANONYMOUS_SESSION and request.user.username != ANONYMOUS_USERNAME):
        return HttpResponseRedirect(redirect_to)
    form = LoginForm(request.POST or None)
    if form.is_valid():
        user = form.save()
        login(request, user)
        if ANONYMOUS_SESSION:
            request.session['ANONYMOUS_SESSION'] = True
        return HttpResponseRedirect(redirect_to)
    elif request.method == "POST":
        reset_url = request.build_absolute_uri(reverse('reset_pw'))
        messages.add_message(request, messages.INFO,
                             MESSAGES['RESET_MESSAGE'].format(reset_url=reset_url))

    return render_to_response('login.html', {
        'page_name': page_name,
        'form': form,
        'oauth_providers': _get_oauth_providers(),
        'redirect_to': redirect_to,
        }, context_instance=RequestContext(request))
595637
def get_login_redirect(self, provider, account):
        """"""
        info = self.model._meta.app_label, self.model._meta.model_name
        # inline import to prevent circular imports.
        from .admin import PRESERVED_FILTERS_SESSION_KEY
        preserved_filters = self.request.session.get(PRESERVED_FILTERS_SESSION_KEY, None)
        redirect_url = reverse('admin:%s_%s_changelist' % info)
        if preserved_filters:
            redirect_url = add_preserved_filters(
                {'preserved_filters': preserved_filters, 'opts': self.model._meta}, redirect_url)
        return redirect_url
196730
def login(user, password)
      endpoint = URI.parse(QUORA_URI)

      http = Net::HTTP.new(endpoint.host, endpoint.port)
      resp = http.get('/login/')
      cookie = resp["set-cookie"]

      # TODO: improve this rubbish
      # get formkey value
      start = resp.body.index("Q.formkey")
      formkey = resp.body[start..start+200].split("\"")[1]

      # get window value
      start = resp.body.index("webnode2.windowId")
      window = resp.body[start..start+200].split("\"")[1]

      # get __vcon_json value
      start = resp.body.index("InlineLogin")
      vcon_json = resp.body[start..start+200]
      start = vcon_json.index("live")
      vcon_json = vcon_json[start..-1]
      vcon_json = vcon_json.split("\"")[0]
      vcon_json = vcon_json.split(":")
      vcon_json.map! { |value| "\"#{value}\"" }

      vcon_json = "[#{vcon_json.join(",")}]"
      vcon_json = CGI::escape(vcon_json)

      user = CGI::escape(user)
      password = CGI::escape(password)

      body = "json=%7B%22args%22%3A%5B%22#{user}%22%2C%22#{password}%22%2Ctrue%5D%2C%22kwargs%22%3A%7B%7D%7D&formkey=#{formkey}&window_id=#{window}&__vcon_json=#{vcon_json}&__vcon_method=do_login"

      headers = {
        "Content-Type"     => "application/x-www-form-urlencoded",
        "X-Requested-With" => "XMLHttpRequest",
        "Accept"           => "application/json, text/javascript, */*",
        "Cookie"           => cookie,
        "User-Agent"       => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10",
        "Content-Length"   => body.length.to_s,
        "Accept-Charset"   => "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
        "Accept-Language"  => "es-ES,es;q=0.8",
        "Accept-Encoding"  => "gzip,deflate,sdch",
        "Origin"           => "http://www.quora.com",
        "Host"             => "www.quora.com",
        "Referer"          => "http://www.quora.com/login/"
      }

      resp = http.post("/webnode2/server_call_POST", body, headers)

      if resp.code == "200"
        cookie
      else
        ""
      end
    end
263282
def get_glance_url(url_base, tenant_id, user, password, region):
    
    get_url(url_base, tenant_id, user, password, 'image', region)
367229
def get_signin_vcode(cookie, codeString):
    '''
    '''
    url = ''.join([
        const.PASSPORT_BASE,
        'cgi-bin/genimage?',
        codeString,
    ])
    headers={
        'Cookie': cookie.header_output(),
        'Referer': const.REFERER,
    }
    req = net.urlopen(url, headers=headers)
    if req:
        return req.data
    else:
        return None
1023069
function getCurrentUrl(page, ph, callback) {
    page.get('url', function (url) {
        callback(null, page, ph, url);
    });
}
1261535
private String getLoginFormURL(HttpServletRequest req, HttpServletResponse res) throws IOException {

        CmsHttpAuthenticationSettings httpAuthenticationSettings = OpenCms.getSystemInfo().getHttpAuthenticationSettings();
        String loginFormURL = null;

        // this will create an admin user with the "right" site root already set
        CmsObject adminCms;
        try {
            adminCms = initCmsObject(req, res, OpenCms.getDefaultUsers().getUserAdmin(), null, null);
        } catch (CmsException e) {
            // this should never happen, if it does we can't continue
            throw new IOException(
                Messages.get().getBundle().key(
                    Messages.ERR_INVALID_INIT_USER_2,
                    OpenCms.getDefaultUsers().getUserAdmin(),

                    null),
                e);
        }
        // get the requested resource
        String path = adminCms.getRequestContext().getUri();
        CmsProperty propertyLoginForm = null;
        try {
            propertyLoginForm = adminCms.readPropertyObject(path, CmsPropertyDefinition.PROPERTY_LOGIN_FORM, true);
        } catch (Throwable t) {
            if (t instanceof CmsVfsResourceNotFoundException) {
                // if we can't read the property from the path, try to use the resource init handlers to find the
                // resource to read it from
                CmsResource alternativeResource = null;
                try {
                    // use null as the response to avoid side effects like redirects, etc.
                    alternativeResource = initResource(adminCms, path, req, null);
                    if (alternativeResource != null) {
                        propertyLoginForm = adminCms.readPropertyObject(
                            adminCms.getSitePath(alternativeResource),
                            CmsPropertyDefinition.PROPERTY_LOGIN_FORM,
                            true);
                    }
                } catch (Exception e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }

            if (propertyLoginForm == null) {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(
                        Messages.get().getBundle().key(
                            Messages.LOG_ERROR_READING_AUTH_PROP_2,
                            CmsPropertyDefinition.PROPERTY_LOGIN_FORM,
                            path),
                        t);
                }

            }
        }

        String params = null;
        if ((propertyLoginForm != null)
            && (propertyLoginForm != CmsProperty.getNullProperty())
            && CmsStringUtil.isNotEmpty(propertyLoginForm.getValue())) {
            // login form property value was found
            // build a redirect URL using the value of the property
            // "__loginform" is a dummy request parameter that could be used in a JSP template to trigger
            // if the template should display a login formular or not
            loginFormURL = propertyLoginForm.getValue();
            params = "__loginform=true";
        } else if (!httpAuthenticationSettings.useBrowserBasedHttpAuthentication()
            && CmsStringUtil.isNotEmpty(httpAuthenticationSettings.getFormBasedHttpAuthenticationUri())) {
            // login form property value not set, but form login set in configuration
            // build a redirect URL to the default login form URI configured in opencms.properties
            loginFormURL = httpAuthenticationSettings.getFormBasedHttpAuthenticationUri();
        }

        String callbackURL = CmsRequestUtil.encodeParamsWithUri(path, req);
        if (loginFormURL != null) {
            if (!loginFormURL.startsWith("http")) {
                loginFormURL = m_linkManager.substituteLink(adminCms, loginFormURL, null, true);
            } else {
                callbackURL = m_linkManager.getServerLink(adminCms, path);
                callbackURL = CmsRequestUtil.encodeParamsWithUri(callbackURL, req);
            }
        }

        return m_authorizationHandler.getLoginFormURL(loginFormURL, params, callbackURL);
    }
273291
def _get_client_and_key(url, user, password, verbose=0):
    '''
    
    '''
    session = {}
    session['client'] = six.moves.xmlrpc_client.Server(url, verbose=verbose, use_datetime=True)
    session['key'] = session['client'].auth.login(user, password)

    return session
701747
function fetchStarred(login, nextPageUrl) {
  return {
    login,
    [CALL_API]: {
      types: [STARRED_REQUEST, STARRED_SUCCESS, STARRED_FAILURE],
      endpoint: nextPageUrl,
      schema: Schemas.REPO_ARRAY
    }
  };
}
1261332
async def _get_auth_page(self) -> str:
        
        # Prepare request
        params = {
            'client_id': self.app_id,
            'redirect_uri': 'https://oauth.vk.com/blank.html',
            'display': 'mobile',
            'response_type': 'token',
            'v': self.API_VERSION
        }
        if self.scope:
            params['scope'] = self.scope

        # Send request
        status, response = await self.driver.get_text(self.AUTH_URL, params)

        # Process response
        if status != 200:
            error_dict = json.loads(response)
            raise VkAuthError(error_dict['error'], error_dict['error_description'], self.AUTH_URL, params)
        return response
273824
def get_login_redirect_url(self, request):
        
        assert request.user.is_authenticated
        url = getattr(settings, "LOGIN_REDIRECT_URLNAME", None)
        if url:
            warnings.warn("LOGIN_REDIRECT_URLNAME is deprecated, simply"
                          " use LOGIN_REDIRECT_URL with a URL name",
                          DeprecationWarning)
        else:
            url = settings.LOGIN_REDIRECT_URL
        return resolve_url(url)