예제 #1
0
파일: IFM_vkcom.py 프로젝트: Ra93POL/ManSPy
def init():
    global Oauth
    Oauth = oauth.authorize(passwords)
    Oauth.print_log = True
    while 1:
        ToUser()
        FromUser()
예제 #2
0
def authenticate(client_id=None, client_secret=None, tokens=[], token=None):
    if not client_id:
        client_id = os.environ.get('FACEBOOK_INSIGHTS_CLIENT_ID')
    if not client_secret:
        client_secret = os.environ.get('FACEBOOK_INSIGHTS_CLIENT_SECRET')

    secrets = client_id and client_secret
    credentials = token or tokens
    if secrets:
        tokens = oauth.authorize(client_id, client_secret)
    elif credentials:
        pass
    else:
        raise KeyError(
            utils.dedent("""
            Authentication requires either one or more tokens, 
            or a client_id and client_secret passed to this 
            function or available in the environment as 
            FACEBOOK_INSIGHTS_CLIENT_ID and 
            FACEBOOK_INSIGHTS_CLIENT_SECRET.
            """))
    if token:
        return graph.Page(token)
    else:
        return [graph.Page(token) for token in tokens]
예제 #3
0
def oauth_authorize(provider):
    if not current_user.is_anonymous:
        return redirect(url_for('index'))
        #return redirect(url_for('mainpage'))
    session['logstatus']=0
    oauth = OAuthSignIn.get_provider(provider)
    return oauth.authorize()
예제 #4
0
def init(app_only=False, force=False):
	if force:
		if app_only:
			config.twitter_bearer = application_only_authentication.get_assess_token(
					config.twitter_consumer_key, config.twitter_consumer_secret)
		else:
			config.twitter_access_token, config.twitter_access_token_secret = \
					oauth.authorize(config.twitter_consumer_key, config.twitter_consumer_secret)
		util.save_to_json()

	if app_only:
		if not config.twitter_bearer:
			util.load_from_json()
		if not config.twitter_bearer:
			config.twitter_bearer = application_only_authentication.get_assess_token(
					config.twitter_consumer_key, config.twitter_consumer_secret)
			util.save_to_json()
	else:
		if not config.twitter_access_token or not config.twitter_access_token_secret:
			util.load_from_json()
		if not config.twitter_access_token or not config.twitter_access_token_secret:
			config.twitter_access_token, config.twitter_access_token_secret = \
					oauth.authorize(config.twitter_consumer_key, config.twitter_consumer_secret)
			util.save_to_json()
예제 #5
0
def init(app_only=False, force=False):
    if force:
        if app_only:
            config.twitter_bearer = application_only_authentication.get_assess_token(
                config.twitter_consumer_key, config.twitter_consumer_secret)
        else:
            config.twitter_access_token, config.twitter_access_token_secret = \
              oauth.authorize(config.twitter_consumer_key, config.twitter_consumer_secret)
        util.save_to_json()

    if app_only:
        if not config.twitter_bearer:
            util.load_from_json()
        if not config.twitter_bearer:
            config.twitter_bearer = application_only_authentication.get_assess_token(
                config.twitter_consumer_key, config.twitter_consumer_secret)
            util.save_to_json()
    else:
        if not config.twitter_access_token or not config.twitter_access_token_secret:
            util.load_from_json()
        if not config.twitter_access_token or not config.twitter_access_token_secret:
            config.twitter_access_token, config.twitter_access_token_secret = \
              oauth.authorize(config.twitter_consumer_key, config.twitter_consumer_secret)
            util.save_to_json()
예제 #6
0
def auth():
    return oauth.authorize()