File size: 798 Bytes
56d74b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# coding=utf-8
import logging

from atlassian import Bitbucket

logging.basicConfig(level=logging.DEBUG, format="[%(asctime).19s] [%(levelname)s] %(message)s")
logging.getLogger("requests").setLevel(logging.WARNING)
log = logging.getLogger("bitbucket-projects-administrators")

bitbucket = Bitbucket(url="http://localhost:7990", username="admin", password="admin")

html = "<table><tr><th>Project Key</th><th>Project Name</th><th>Administrator</th></tr>"

for data in bitbucket.all_project_administrators():
    html += "<tr><td>{project_key}</td><td>{project_name}</td><td><ul>".format(**data)
    for user in data["project_administrators"]:
        html += '<li><a href="mailto:{email}">{name}</a></li>'.format(**user)
    html += "</ul></td></tr>"

html += "</table><p></p><p></p>"

print(html)