本文整理汇总了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())
示例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')))
示例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')))