当前位置: 首页>>代码示例>>Python>>正文


Python FlickrAPI.web_login_url方法代码示例

本文整理汇总了Python中flickrapi.FlickrAPI.web_login_url方法的典型用法代码示例。如果您正苦于以下问题:Python FlickrAPI.web_login_url方法的具体用法?Python FlickrAPI.web_login_url怎么用?Python FlickrAPI.web_login_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flickrapi.FlickrAPI的用法示例。


在下文中一共展示了FlickrAPI.web_login_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: register

# 需要导入模块: from flickrapi import FlickrAPI [as 别名]
# 或者: from flickrapi.FlickrAPI import web_login_url [as 别名]
def register():
    if g.user is not None or 'openid' not in session:
        return redirect(oid.get_next_url())

    # Registration form
    form = RegisterForm(request.form)
    if 'openid' in session:
        form.password.validators = []
        form.confirm.validators = []

    if form.validate_on_submit():
        # Create a user instance not yet stored in the database
        user = User(form.screen_name.data, form.email.data, form.real_name.data)
        if 'openid' in session:
            user.openid = session['openid']
        else:
            user.password = generate_password_hash(form.password.data)

        if form.flickr_auth.data:  # User selected to authorize their screen name as a flickr account
            session['tmp_flickr_user'] = user;
            api_key = os.environ['PARAM1']
            api_secret = os.environ['PARAM2']
            flickr = FlickrAPI(api_key, api_secret, store_token = False)

            login_url = flickr.web_login_url('read')
            return redirect(login_url)
        else:
            # Insert the record in our data base and commit it
            db.session.add(user)
            db.session.commit()

            # Log the user in, as he now has an ID
            session['user_id'] = user.id
    
        flash('Thank you for registering with Brickr!')
        return redirect(url_for('index'))  # Send newly minted user to their Brickr landing page
    return render_template('users/register.html', form = form, next = oid.get_next_url())
开发者ID:remig,项目名称:brickr,代码行数:39,代码来源:users.py

示例2: login

# 需要导入模块: from flickrapi import FlickrAPI [as 别名]
# 或者: from flickrapi.FlickrAPI import web_login_url [as 别名]
	def login(self):
		fapi = FlickrAPI(config['api_key'], config['api_secret'])
		redirect(url(fapi.web_login_url('write')))
开发者ID:wiredfool,项目名称:fmod,代码行数:5,代码来源:flickr.py

示例3: login_user

# 需要导入模块: from flickrapi import FlickrAPI [as 别名]
# 或者: from flickrapi.FlickrAPI import web_login_url [as 别名]
	def login_user(self):
		# so that we have a 1:1 correspondence between the flickr usernames
		# and our application usernames. 
		fapi = FlickrAPI(config['api_key'], config['api_secret'])
		redirect(url(fapi.web_login_url('read')))
开发者ID:wiredfool,项目名称:fmod,代码行数:7,代码来源:flickr.py


注:本文中的flickrapi.FlickrAPI.web_login_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。