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


Python FlickrAPI.auth_url方法代码示例

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


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

示例1: get_flickr

# 需要导入模块: from flickrapi import FlickrAPI [as 别名]
# 或者: from flickrapi.FlickrAPI import auth_url [as 别名]
def get_flickr(config_file):
	config = ConfigParser.ConfigParser()
	config.read(config_file)

	api_key = config.get('Flickr', 'api_key')
	api_secret = config.get('Flickr', 'api_secret')
	api = FlickrAPI(api_key, api_secret, cache=True)
	if not api.token_valid(perms=u'read'):
                            api.get_request_token(oauth_callback='oob')
                            authorize_url = api.auth_url(perms=u'read')
                            verifier = unicode(raw_input('Verifier code for %s:' % authorize_url))
                            api.get_access_token(verifier)
	return api
开发者ID:jgsogo,项目名称:facematch,代码行数:15,代码来源:down_flickr_album.py

示例2: print

# 需要导入模块: from flickrapi import FlickrAPI [as 别名]
# 或者: from flickrapi.FlickrAPI import auth_url [as 别名]
    apisecret = u'03fbb3ea705fe096'

print('Creating FlickrAPI object')

flickr = FlickrAPI(keys.apikey, keys.apisecret)

# ------------------------------------------------------------------------------
print('Step 1: authenticate')

if not flickr.token_valid(perms='read'):
    # Get a request token
    flickr.get_request_token(oauth_callback='oob')
    
    # Open a browser at the authentication URL. Do this however
    # you want, as long as the user visits that URL.
    authorize_url = flickr.auth_url(perms='read')
    webbrowser.open_new_tab(authorize_url)
    
    # Get the verifier code from the user. Do this however you
    # want, as long as the user gives the application the code.
    verifier = unicode(raw_input('Verifier code: '))
    
    # Trade the request token for an access token
    flickr.get_access_token(verifier)

# ------------------------------------------------------------------------------
print('Step 2: use Flickr')
resp = flickr.photos.getInfo(photo_id='7658567128')

ET.dump(resp)
开发者ID:SpootDev,项目名称:flickrapi,代码行数:32,代码来源:oauth_test_3-oob.py


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