Exemple #1
0
def list_inactive(obj, days, null=False):
    """List inacitve users.

    WARNING! THIS IS NOT OFFICIALLY SUPPORTED BY FLOWDOCK API!

    Users are considered if they haven't used the Flowdock organization during
    last 90 days (customizable, see --days).

    By passing option --null list users who have not been active at all or the
    last time was before flowdock started collecting statistics.
    """
    click.secho("WARNING! This method is not supported by Flowdock!",
                bold=True, fg='red')

    if null:
        click.echo("Listing users that have not been active at all")
    else:
        click.echo("Listing users who have not been active during last {} days"
                   .format(days))

    f = Flowdock(obj['APIKEY'], debug=obj['DEBUG'], print_function=click.echo)
    orgs = f.list_organizations()
    for org in orgs:
        inactive = f.find_inactive_in_org(org['parameterized_name'], days, null)
        if len(inactive) > 0:
            click.echo(org['name'])
            for user in inactive:
                click.echo("    {}, {}".format(user['email'], user['accessed_at']))

    f.close()
Exemple #2
0
def list_orgs(obj):
    """List flowdock organizations this user is part of."""
    click.echo("Getting organization list...")
    f = Flowdock(obj['APIKEY'], debug=obj['DEBUG'], print_function=click.echo)
    orgs = f.list_organizations()
    f.close()
    for org in orgs:
        print_org(org)