Skip to content

Instantly share code, notes, and snippets.

@catalinaturlea
Created June 12, 2018 15:04
Show Gist options
  • Save catalinaturlea/c86c3a5607b91ee1597b66a9657bce50 to your computer and use it in GitHub Desktop.
Save catalinaturlea/c86c3a5607b91ee1597b66a9657bce50 to your computer and use it in GitHub Desktop.
youtrack-reporting-flow
import sys
from youtrack.connection import Connection as YouTrack
#// authentication request with permanent token
#yt = YouTrack('https://instance_name.myjetbrains.com/youtrack/', token='perm:abcdefghijklmn')
#// versus authentication with username and password
yt = YouTrack('https://everskill.myjetbrains.com/youtrack/', login='username', password='password')
def print_issues(project, issues, type):
sys.stdout.write("<br><h2>" + project + ": " + type + "</h2>")
for issue in issues:
if issue.Type == type:
print_issue(issue)
def print_issues_with_component(project, issues, type, component):
sys.stdout.write("<br><h2>" + project + ": " + type + " - " + component + "</h2>")
for issue in issues:
if issue.Type == type and issue.Component == component:
print_issue(issue)
def print_issue(issue):
tags = "" if not issue.tags else '[%s]' % ', '.join(map(str, issue.tags or []))
# status = u'\u2714' if issue.State == 'Done' else u'\u2718'
# status = status.encode('ascii', 'ignore')
status = "<span style=\"color:green\">&#10003;</span>" if issue.State == 'Done' else "<span style=\"color:red\">&#10007;</span>"
# issue.id - for the ID
sys.stdout.write("<br>" + status + " " + tags + " " + issue.summary + "<br>")
projects = ['MF', 'WF', 'BD', 'AS']
for project in projects:
issues = yt.getIssues(project, 'Sprints:18#23', 0, 200)
sys.stdout.write("<head><meta charset=\"UTF-8\"></head>")
sys.stdout.write("<meta name=\"viewport\" content=\"initial-scale=1.0\" /><style> body { color: #404040; font-family: 'Roboto', sans-serif; font-size: 20px; font-weight: 300; } a { color: #4B1DCC } div.heading { padding: 28px 0 20px 0; } h1, h2 { color: #4B1DCC; font-size: 28px; font-weight: \(boldWeight); } img { width: 100%; margin: 20px 0 20px 0; } div.icon-header { margin: 40px 0 20px 0; font-weight: \(boldWeight);} div.icon { float: left; margin: 0 20px 0 20px; width: 40px; height: 40px; } span.icon { font-size: 28px; } b { font-weight: 300; } a { font-weight: 400; color: #4B1DCC; } </style>")
# sys.stdout.write("<br><hr><br><h1>" + project + "</h1><br>")
if project == 'MF':
components = ['Android', 'iOS']
for component in components:
print_issues_with_component(project, issues, "Bug", component)
print_issues_with_component(project, issues, "User Story", component)
else :
print_issues(project, issues, "Bug")
print_issues(project, issues, "User Story")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment