Ejemplo n.º 1
0
def list_users(tracked):
    conf, err = read_db()
    with db.session(conf) as s:
        for u in s.query(db.User):
            if tracked and not u.is_tracking:
                continue
            click.echo('{team} {name}'.format(team=u.team, name=u.screen_name))
Ejemplo n.º 2
0
def list_users(tracked):
    conf, err = read_db()
    with db.session(conf) as s:
        for u in s.query(db.User):
            if tracked and not u.is_tracking:
                continue
            click.echo('{team} {name}'.format(team=u.team,
                                              name=u.screen_name))
Ejemplo n.º 3
0
 def on_status(self, status):
     with db.session(self.db) as session:
         if hasattr(status, 'retweeted_status'):
             add_retweet(session, status.user, status.retweeted_status)
             return
         add_get_tweet(session, status)
     try:
         click.echo('"{}" --{}'.format(status.text,
                                       status.user.screen_name))
     except:
         pass
Ejemplo n.º 4
0
 def on_status(self, status):
     with db.session(self.db) as session:
         if hasattr(status, 'retweeted_status'):
             add_retweet(session, status.user, status.retweeted_status)
             return
         add_get_tweet(session, status)
     try:
         click.echo('"{}" --{}'.format(status.text,
                                       status.user.screen_name))
     except:
         pass
Ejemplo n.º 5
0
def add_user(team, users):
    if len(team) != 3:
        raise IOError()
    conf, err = read_db()
    with db.session(conf) as s:
        for u in users:
            twit_user = listener.get_api().get_user(u)
            if not twit_user:
                continue
            db_user = listener.get_user(s, twit_user)
            db_user.team = team
            db_user.is_tracking = True
            s.merge(db_user)
            click.echo('Added {name}'.format(name=db_user.screen_name))
Ejemplo n.º 6
0
def add_user(team, users):
    if len(team) != 3:
        raise IOError()
    conf, err = read_db()
    with db.session(conf) as s:
        for u in users:
            twit_user = listener.get_api().get_user(u)
            if not twit_user:
                continue
            db_user = listener.get_user(s, twit_user)
            db_user.team = team
            db_user.is_tracking = True
            s.merge(db_user)
            click.echo('Added {name}'.format(name=db_user.screen_name))