Ejemplo n.º 1
0
        
        # 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' })