本文整理匯總了Python中embedly.Embedly.preview方法的典型用法代碼示例。如果您正苦於以下問題:Python Embedly.preview方法的具體用法?Python Embedly.preview怎麽用?Python Embedly.preview使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類embedly.Embedly
的用法示例。
在下文中一共展示了Embedly.preview方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Embedly
# 需要導入模塊: from embedly import Embedly [as 別名]
# 或者: from embedly.Embedly import preview [as 別名]
# r.sadd('url_index', "%s:%s" % (r.get('current_index'), url['expanded_url']))
# r.hset('urls', url['expanded_url'], obj)
# r.incr('current_index')
"""
Initialize the app
"""
print 'Connecting to Redis... ',
# create Redis connection
r = redis.StrictRedis(host='localhost', port=6379, db=0)
r.flushdb()
if not r.exists('current_index'):
r.set('current_index', 0)
print 'connected'
print 'Creating Embedly client... ',
e = Embedly(sys.argv[3])
print 'created'
print 'Testing Embedly endpoint... ',
obj = e.preview('http://google.com/')
if obj.error:
exit('embedly endpoint failed (http response %s)' % obj.error_code)
print 'passed'
print 'Attaching nozzle to Twitter firehose... '
attach_nozzle(hose, { 'track': 'instagr' })