print e try: staging_cursor = staging_conn.cursor() staging_cursor.execute('select uid from experiments where experiment=%s and followed_us=0 and followed_them=0 limit 300',(experiment)) index=0 for row in staging_cursor.fetchall(): uid = row[0] access_token = Bestgames.ACCESS_TOKENS[index%8] if is_follow_v2(access_token, Bestgames.UID, uid): print '%d: %s is followed' % (index, uid) follow_them(experiment, uid) else: print '%d: follow %s' % (index, uid) if follow_v2(access_token, uid): if is_follow_v2(access_token, Bestgames.UID, uid): follow_them(experiment, uid) else: print '%d: follow %s failed' % (index, uid) time.sleep(15) index = index + 1 except Exception,e: print e staging_cursor.close() staging_conn.close() curve1 = [0.05, 0.02, 0.02, 0.01, 0.01, 0.01, 0.01, 0.01, 0.03, 0.04, 0.05, 0.05, 0.06, 0.06, 0.05, 0.06, 0.06, 0.06, 0.06, 0.06, 0.05, 0.06, 0.06, 0.07] def addfans(experiment, curve):
print '%s already follow me' % (uid) db_follow_me(uid) else: follow_v1(row[2], row[3], Bestgames.UID) if is_followed_by_v2(Bestgames.ACCESS_TOKENS[index%8], Bestgames.UID, uid): print '%s follow me' % (uid) db_follow_me(uid) else: print 'follow me failed' time.sleep(60) elif version == 2: if is_followed_by_v2(Bestgames.ACCESS_TOKENS[index%8], Bestgames.UID, uid): print '%s already follow me' % (uid) db_follow_me(uid) else: follow_v2(row[2], Bestgames.UID) time.sleep(5) if is_followed_by_v2(Bestgames.ACCESS_TOKENS[index%8], Bestgames.UID, uid): print '%s follow me' % (uid) db_follow_me(uid) else: print 'follow me failed' time.sleep(55) elif taskType == TaskType.FOLLOW_THEM: if is_follow_v2(Bestgames.ACCESS_TOKENS[index%8], Bestgames.UID, uid): print '%s already follow them' % (uid) db_follow_them(uid) else: follow_v2(Bestgames.ACCESS_TOKENS[index%8], uid) time.sleep(5) if is_follow_v2(Bestgames.ACCESS_TOKENS[index%8], Bestgames.UID, uid):