Logout current session

          **Parameters:**:

          - **api_version**: API version to use (default v2.0)

        **Returns:** requests.Response object extended with cgx_status and cgx_content properties.
325672
def logout(self, api_version="v2.0"):
        

        cur_ctlr = self._parent_class.controller

        url = str(cur_ctlr) + "/{}/api/logout".format(api_version)

        api_logger.debug("URL = %s", url)
        return self._parent_class.rest_call(url, "get")
762758
def oauth_logout_handler(sender_app, user=None):
    """"""
    oauth = current_app.extensions['oauthlib.client']
    for remote in oauth.remote_apps.values():
        token_delete(remote)
    db.session.commit()
1351262
def login(self):
        
        response = self._request('Login')
        parser = OneXLogin()
        parser.parse(response)

        self.session_id = response.cookies.get(self.session_id_cookie_name, '')

        if parser.headers.get('RETS-Version') is not None:
            self.version = str(parser.headers.get('RETS-Version'))
            self.client.headers['RETS-Version'] = self.version

        for k, v in parser.capabilities.items():
            self.add_capability(k, v)

        if self.capabilities.get('Action'):
            self._request('Action')
        return True
1086881
def logout(self, all_session=False):
        
        # initialize the counter of the number of destroyed sesisons
        session_nb = 0
        # save the current user username before flushing the session
        username = self.request.session.get("username")
        if username:
            if all_session:
                logger.info("Logging out user %s from all sessions." % username)
            else:
                logger.info("Logging out user %s." % username)
        users = []
        # try to get the user from the current session
        try:
            users.append(
                models.User.objects.get(
                    username=username,
                    session_key=self.request.session.session_key
                )
            )
        except models.User.DoesNotExist:
            # if user not found in database, flush the session anyway
            self.request.session.flush()

        # If all_session is set, search all of the user sessions
        if all_session:
            users.extend(
                models.User.objects.filter(
                    username=username
                ).exclude(
                    session_key=self.request.session.session_key
                )
            )

        # Iterate over all user sessions that have to be logged out
        for user in users:
            # get the user session
            session = SessionStore(session_key=user.session_key)
            # flush the session
            session.flush()
            # send SLO requests
            user.logout(self.request)
            # delete the user
            user.delete()
            # increment the destroyed session counter
            session_nb += 1
        if username:
            logger.info("User %s logged out" % username)
        return session_nb
931089
def logout_listener(app, user):
    
    @after_this_request
    def _commit(response=None):
        if hasattr(session, 'sid_s'):
            delete_session(session.sid_s)
        # Regenerate the session to avoid session fixation vulnerabilities.
        session.regenerate()
        current_accounts.datastore.commit()
        return response
669622
def get_api_version(base_url, api_version=None, timeout=10, verify=True):
    
    versions = available_api_versions(base_url, timeout, verify)
    
    newest_version = max([float(i) for i in versions])
    if api_version is None:  # Use latest
        api_version = newest_version
    else:
        if api_version not in versions:
            api_version = newest_version
    
    return api_version
953966
def logged_in(self):
    
    if self.session is None:
      return False

    panel_url = u'http://myanimelist.net/panel.php'
    panel = self.session.get(panel_url)

    if 'Logout' in panel.content:
      return True

    return False
904752
public ApiResponse<GetLogout> getLogoutWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = getLogoutValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<GetLogout>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
1007777
def login(self, response):
        
        self._state_params['auth'] = response['auth']
        self._user_data = response['user']
        if not self.logged_in:
            raise ApiLoginFailure(response)
484292
def session(self):
        
        if self._session is None:
            self._session = requests.session()
            self._session.headers.update(
                {
                    "Authorization": "Bearer {}".format(self.token),
                    "User-Agent": "ads-api-client/{}".format(__version__),
                    "Content-Type": "application/json",
                }
            )
        return self._session
923723
def Logout(self, dumpXml=None):
		
		from UcsBase import UcsException

		if (self._cookie == None):
			return True

		if self._refreshTimer:
			self._refreshTimer.cancel()

		response = self.AaaLogout(dumpXml)
		self._cookie = None
		self._lastUpdateTime = str(time.asctime())
		self._domains = None
		self._priv = None
		self._sessionId = None
		self._version = None

		if self._ucs in defaultUcs:
			del defaultUcs[self._ucs]

		if (response.errorCode != 0):
			raise UcsException(response.errorCode, response.errorDescr)
		# raise Exception('[Error]: Logout [Code]:' + response.errorCode + '[Description]:' + response.errorDescr)

		return True
514596
def logout(session, cookies, csrf_token):
    '''
    
    '''
    payload = {"jsonrpc": "2.0",
               "id": "ID0",
               "method": "logout",
               "params": []
               }
    session.post(DETAILS['url'],
                 data=json.dumps(payload),
                 cookies=cookies,
                 headers={'X-CSRF-Token': csrf_token})
651854
def _get_authenticated_session(self):
        
        session = requests.Session()
        session.auth = self.auth
        return session
555099
def logout(self, request, extra_context=None):
        
        from django.contrib.auth.views import logout
        defaults = {
            'extra_context': extra_context or {},
            'template_name': 'cms/logged_out.html',
        }
        if self.logout_template is not None:
            defaults['template_name'] = self.logout_template
        return logout(request, **defaults)
270337
def logout(self):
        
        if not self.session:
            self.manager._deregister(self)
            return
        try:
            r = self.session.put(self.entry_points.get('logout'))
            if r.status_code == 204:
                logger.info('Logged out admin: %s of domain: %s successfully',
                    self.name, self.domain)
            else:
                logger.error('Logout status was unexpected. Received response '
                    'with status code: %s', (r.status_code))

        except requests.exceptions.SSLError as e:
            logger.error('SSL exception thrown during logout: %s', e)
        except requests.exceptions.ConnectionError as e:
            logger.error('Connection error on logout: %s', e)
        finally:
            self.entry_points.clear()
            self.manager._deregister(self)
            self._session = None
            try:
                delattr(self, 'current_user')
            except AttributeError:
                pass
        
        logger.debug('Call counters: %s' % counters)
824695
def logout(self):
        
        url = self.address + "/logout"
        header = self.__check_authentication()
        response = requests.get(url, headers=header)
        if response.status_code != 200:
            raise ValueError("Code {}. {}".format(response.status_code, response.json().get("error")))
821773
def get_session():
    
    config = PyquilConfig()
    session = requests.Session()
    retry_adapter = HTTPAdapter(max_retries=Retry(total=3,
                                                  method_whitelist=['POST'],
                                                  status_forcelist=[502, 503, 504, 521, 523],
                                                  backoff_factor=0.2,
                                                  raise_on_status=False))

    session.mount("http://", retry_adapter)
    session.mount("https://", retry_adapter)

    # We need this to get binary payload for the wavefunction call.
    session.headers.update({"Accept": "application/octet-stream",
                            "X-User-Id": config.user_id,
                            "X-Api-Key": config.api_key})

    session.headers.update({
        'Content-Type': 'application/json; charset=utf-8'
    })

    return session