In [ ]:
import os.path
import pandas as pd

from ovation.session import connect

Connect


In [ ]:
s = connect(input('Email: '))

Get "Member" role


In [ ]:
member_role = [r for r in s.get('/roles') if r.name == 'Member'][0]
member_role

Load teams and members


In [ ]:
members_path = os.path.expanduser(input('Members: '))

In [ ]:
projects_path = os.path.expanduser(input('Projects: '))

In [ ]:
members = pd.read_csv(members_path, header=0, names=['name', 'email'])
members.head()

In [ ]:
projects = pd.read_csv(projects_path, header=0, names=['name', 'uuid'])
projects.head()

Add memberships


In [ ]:
for project_id in projects.uuid:
    for member in members:
        # TODO assumes membership does not already exist
        membership = {"membership": {"email": member,
                                     "role": member_role}}
        s.post('/teams/{}'.format(project_id), data=membership)