Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 49f53a0

Browse files
authored
Merge pull request #150 from mkoeppe/machine_readable_status
/ticket/<int:ticket>/status: New route
2 parents 97ae6a2 + b5368c3 commit 49f53a0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

sage_patchbot/server/serve.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,26 @@ def render_ticket_base_svg(ticket):
531531
response.content_type = 'image/svg+xml'
532532
return response
533533

534+
@app.route("/ticket/<int:ticket>/status")
535+
def ticket_status(ticket):
536+
try:
537+
if 'fast' in request.args:
538+
info = tickets.find_one({'id': ticket})
539+
else:
540+
info = scrape(ticket, db=db)
541+
except Exception:
542+
info = tickets.find_one({'id': ticket})
543+
544+
if 'base' in request.args:
545+
base = request.args.get('base')
546+
else:
547+
base = latest_version(info.get('reports', []))
548+
549+
status = get_ticket_status(info, base=base)[1] # single status
550+
551+
response = make_response(status)
552+
response.headers['Content-type'] = 'text/plain'
553+
return response
534554

535555
@app.route("/ticket/<int:ticket>/status.svg")
536556
def render_ticket_status_svg(ticket):

0 commit comments

Comments
 (0)