Example #1
0
    print(r.keys())

print("\nTasks:")
for t in api.get_all_tasks(start_date=start_date, end_date=end_date):
    print(t)

print("\nAll clients:")
for c in api.get_all_clients():
    print(c)

print("\nAll departments:")
for d in api.get_all_departments():
    print(d)

print("\nAll accounts:")
for a in api.get_all_accounts():
    print(a)

# Create a project
#project = api.create_project(name='Project FooBar ')
#print(project)

# Delete a project
#result = api.delete_project(project['project_id'])
#print(result)

# Create a client
#client = api.create_client("Client FooBar")
#print(client)

# Delete a client
Example #2
0
                    "Deleted Float user '{}' because end_date '{}' is +{} days in the past"
                    .format(float_data['name'], float_data['end_date'],
                            delete_after_days))
                float_users_deleted += 1

# A set of emails of float users not matching LDAP users
float_emails_not_in_ldap = float_people.keys() - ldap_user_emails

# Warn about float users with email not matching an LDAP user
for fu_mail in float_emails_not_in_ldap:
    logging.warning("Float user '{}' with email '{}' not in LDAP".format(
        float_people[fu_mail]['name'], fu_mail))

# Warn about accounts with no matching people (A guest)
try:
    accounts = float_api.get_all_accounts()
except (UnexpectedStatusCode, DataValidationError) as e:
    logging.error("Could not get Float accounts. Error was: {}".format(e))
else:
    for a in accounts:
        # Ignore valid guests
        if a['email'] in valid_guests:
            continue

        # Warn about unknown guests
        if a['email'] not in float_people.keys():
            logging.warning(
                "Account with name '{}' and email '{}' has no matching people object"
                .format(a['name'], a['email']))

logging.info("Done running ldap2float.py")