Commit fcb9a97f authored by Лошкарев Сергей Алексеевич's avatar Лошкарев Сергей Алексеевич
Browse files

add TaigaReader class

1 merge request!4many shit
Showing with 24 additions and 7 deletions
+24 -7
......@@ -20,12 +20,29 @@ class Person():
self.bio = user.bio
self.role_name = member.role_name[0],
def get_users_from_taiga(host, username, password, project_slug):
class TaigaReader():
'''
function for connecting to taiga at host, with username and password
and getting information about users from project by project_slug
object to read information from taiga
'''
api = TaigaAPI(host=host)
api.auth(username, password)
members = api.projects.get_by_slug(project_slug).list_memberships()
return [Person(member, api.users.get(member.user)) for member in members]
def __init__(self, taiga_config):
'''
Constructor to TaigaReader
'''
self._api = TaigaAPI(host=taiga_config['host'])
self._api.auth(taiga_config['username'], taiga_config['password'])
def create_person(self, member):
'''
Create Person with member and request to getting information from user
'''
user = api.users.get(member.user)
return Person(member, user)
def get_persons(self):
'''
function for connecting to taiga at host, with username and password
and getting information about users from project by project_slug
'''
members = api.projects.get_by_slug(project_slug).list_memberships()
return map(self.create_person, members)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment