This is a session between the consumer (your website) and the provider
        (e.g. Twitter). It is *not* a session between a user of your website
        and your website.
        :return:
775496
def session(self):
        
        ret = self.session_class(
            client_id=self._client_id,
            client=self.client,
            auto_refresh_url=self.auto_refresh_url,
            auto_refresh_kwargs=self.auto_refresh_kwargs,
            scope=self.scope,
            state=self.state,
            blueprint=self,
            base_url=self.base_url,
            **self.kwargs
        )

        def token_updater(token):
            self.token = token

        ret.token_updater = token_updater
        return self.session_created(ret)
1271366
def session(self, auth=None):
        
        url = '{server}{auth_url}'.format(**self._options)

        if isinstance(self._session.auth, tuple) or auth:
            if not auth:
                auth = self._session.auth
            username, password = auth
            authentication_data = {'username': username, 'password': password}
            r = self._session.post(url, data=json.dumps(authentication_data))
        else:
            r = self._session.get(url)

        user = User(self._options, self._session, json_loads(r))
        return user
477196
def user(self, login=None):
        '''
        
        '''
        if login:
            url = '%s/user/%s' % (self.domain, login)
        else:
            url = '%s/user' % (self.domain)

        res = self.session.get(url, verify=self.session.verify)
        self._check_response(res)

        return res.json()
1080118
def _not_authenticated(self):
        
        self._authenticator = None

        if api_settings.UNAUTHENTICATED_USER:
            self.user = api_settings.UNAUTHENTICATED_USER()
        else:
            self.user = None

        if api_settings.UNAUTHENTICATED_TOKEN:
            self.auth = api_settings.UNAUTHENTICATED_TOKEN()
        else:
            self.auth = None
728820
def connect(self):
        
        if not (self.consumer_key and self.consumer_secret and self.access_token
                and self.access_token_secret):
            raise RuntimeError("MissingKeys")

        if self.client:
            log.info("closing existing http session")
            self.client.close()
        if self.last_response:
            log.info("closing last response")
            self.last_response.close()
        log.info("creating http session")

        self.client = OAuth1Session(
            client_key=self.consumer_key,
            client_secret=self.consumer_secret,
            resource_owner_key=self.access_token,
            resource_owner_secret=self.access_token_secret
        )
1311106
def uid(self):
        
        exp = datetime.datetime.utcnow() + self.expDelay
        claims = {
            'user_info': self.user_info,
            # Note that we use JWT standard 'exp' field to implement session expiration
            # we completely bypass twisted.web session expiration mechanisms
            'exp': calendar.timegm(datetime.datetime.timetuple(exp))}

        return jwt.encode(claims, self.site.session_secret, algorithm=SESSION_SECRET_ALGORITHM)
680335
def get_session_token(self):
        
        # self.logging.info('Getting session token')
        # Rather than testing any previous session tokens to see if they are still valid, simply delete old tokens in
        # preparation of the creation of new ones
        try:
            os.remove(os.path.join(self.file_path, 'session_token'))
        except FileNotFoundError:
            pass
        # Create a new session
        session_request = OAuth1Session(self.consumer_key,
                                        self.consumer_secret,
                                        access_token=self.access_token,
                                        access_token_secret=self.access_secret)
        # Perform a GET request with the appropriate keys and tokens
        r = session_request.get(self.session_token_url)
        # If the status code is '200' (OK), proceed
        if r.status_code == 200:
            # Save the JSON-decoded token secret and token
            self.session_token = r.json()['oauth_token']
            self.session_secret = r.json()['oauth_token_secret']
            # Write the token and secret to file
            self.write_token('session_token', self.session_token, self.session_secret)
        # Any other status than 200 is considered a failure
        else:
            print('Failed:')
            print(r.json()['message'])
1039994
def avatar_url
      avatar_providers = Set.new(%w[FACEBOOK LINKEDIN TWITTER])

      # REFACTOR: Should an authentications decorator be created? If so,
      # override the image_url method using this
      # logic, or we can create an avatar_url method
      return social_avatar_url if avatar_providers.include?(avatar_provider)

      gravatar_url
    end
1134314
def userstream(query_params = {}, &block)
      stream_params = {:host => 'userstream.twitter.com'}
      query_params.merge!(:extra_stream_parameters => stream_params)
      start('/1.1/user.json', query_params, &block)
    end
840675
def authorize():
    
    auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
    url = auth.get_authorization_url()
    print('Open this url on your webbrowser: {0}'.format(url))
    webbrowser.open(url)
    pin = input('Input verification number here: ').strip()

    token_key, token_secret = auth.get_access_token(verifier=pin)

    return OAuthToken(token_key, token_secret)
473765
def logged_in(f):
    

    @wraps(f)
    def wrapped_method(self, *args, **kwargs):
        if not self.reddit.is_oauth_session():
            self.term.show_notification('Not logged in')
            return None
        return f(self, *args, **kwargs)
    return wrapped_method
213308
def session(self):
        
        return self.session_class(
            client_key=self.client_key,
            client_secret=self.client_secret,
            signature_method=self.signature_method,
            signature_type=self.signature_type,
            rsa_key=self.rsa_key,
            client_class=self.client_class,
            force_include_body=self.force_include_body,
            blueprint=self,
            base_url=self.base_url,
            **self.kwargs
        )
1084758
def player
      url = "me/player"
      response = User.oauth_get(@id, url)
      return response if RSpotify.raw_response
      response.present? ? Player.new(self, response) : nil
    end
598512
def web_group(self):
        '''
        '''
        if self._web_group is None:
            self._web_group = self.web_user
        return self._web_group
392523
def GET(self):
        
        if self.user_manager.session_logged_in() or not self.app.allow_registration:
            raise web.notfound()

        error = False
        reset = None
        msg = ""
        data = web.input()

        if "activate" in data:
            msg, error = self.activate_user(data)
        elif "reset" in data:
            msg, error, reset = self.get_reset_data(data)

        return self.template_helper.get_renderer().register(reset, msg, error)
188887
def _build_session(self, auth_class, *args, **kwargs):
        
        session = requests.session()
        session.auth = auth_class(*args, **kwargs)
        session.headers.update({'CB-VERSION': self.API_VERSION,
                                'Accept': 'application/json',
                                'Content-Type': 'application/json',
                                'User-Agent': 'coinbase/python/2.0'})
        return session
503871
def sessions(self):
        
        return pd.to_datetime(
            reduce(
                np.union1d,
                (reader.dates for reader in self._readers.values()),
            ),
            utc=True,
        )