Commit f6977898 authored by Zergey Loshkarev's avatar Zergey Loshkarev
Browse files

add output of users informations

No related merge requests found
Showing with 42 additions and 0 deletions
+42 -0
.gitignore 0 → 100644
venv/
/*.ini
/__pycache__/
\ No newline at end of file
config.py 0 → 100644
from configparser import ConfigParser
import taiga
_CONFIG_FILE = 'config.ini' # config file
def _valid_taiga_config(config: ConfigParser) -> (bool):
if 'taiga' in config.sections():
taiga_dict = dict(config['taiga'])
if (
'host' in taiga_dict and \
'username' in taiga_dict and \
'password' in taiga_dict and \
'project_name' in taiga_dict
):
return True
return False
def read_config(config_filename: str) -> (ConfigParser):
config = ConfigParser()
if config.read(config_filename) == []:
raise Exception('Config file not found')
if not _valid_taiga_config(config):
raise Exception('Unvalid data-format in Taiga\'s config')
return config
\ No newline at end of file
main.py 0 → 100644
from config import read_config
from taiga import TaigaAPI
config = read_config('config.ini')
api = TaigaAPI(host=config['taiga']['host'])
api.auth(
username=config['taiga']['username'],
password=config['taiga']['password']
)
users = api.projects.get_by_slug(config['taiga']['project_name']).list_memberships()
for user in users[:]:
# print(dir(user))
print(f"name: {user.full_name} role_name: {user.role_name} photo: {user.photo} ")
\ No newline at end of file
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