(Updated) Using the bug_mentor field with the Bugzilla REST API to get mentored bugs

In my :doc:`previous post <mentorable_bugs>`_, I mentioned how Bugzilla grew a mentor field and had some code on how to query Bugzilla using the old and new APIs for the list of mentored bugs. This updates that information.

System Message: WARNING/2 (<string>, line 2); backlink

Mismatch: both interpreted text role prefix and reference suffix.

Gerv and Byron pointed out there's a isnotempty operator that's better to use than the way I cobbled together to query for bugs that have data in the bug_mentor field.

Thus, the code should look like this:

import requests

# Using the old BzAPI: https://wiki.mozilla.org/Bugzilla:REST_API
r = requests.get(
    'https://api-dev.bugzilla.mozilla.org/latest' +
    '/bug?product=Input&f1=bug_mentor&o1=isnotempty'
)
data = r.json()
print len(data['bugs'])  # Prints 9


# Using the new BMO API. https://wiki.mozilla.org/BMO/REST
r = requests.get(
    'https://bugzilla.mozilla.org/rest' +
    '/bug?product=Input&f1=bug_mentor&o1=isnotempty'
)
data = r.json()
print len(data['bugs'])  # Prints 9
Want to comment? Send an email to willkg at bluesock dot org. Include the url for the blog entry in your comment so I have some context as to what you're talking about.