Next observation on this script: it dies if a bug number in the given 
range doesn't exist, with an error like:

Marking as spam: PR75336
Traceback (most recent call last):
  File "./mark_spam.py", line 98, in <module>
    mark_as_spam(id, args.api_key, args.verbose)
  File "./mark_spam.py", line 38, in mark_as_spam
    cc_list = response['bugs'][0]['cc']
KeyError: 'bugs'

It would be more convenient if it ignored nonexistent bugs rather than 
falling over like this, so that it's only necessary to check that the 
range you pass to the script has no non-spam bugs in it, not that every 
bug number in the range exists.

(I don't know why there are gaps in the bug numbers; I suppose some error 
/ timeout occurred while the spammers were creating bugs, at a point after 
a bug number had been reserved in the database but before the transaction 
creating the bug was complete - in such circumstances, databases don't 
necessarily unwind the reservation of a number.)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to