diff options
author | Martin Liska <mliska@suse.cz> | 2016-08-17 12:30:54 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2016-08-17 10:30:54 +0000 |
commit | abe95ef6bf44f5e1991b6ad15cd704248b000a27 (patch) | |
tree | b3c8d9000ed256fd9a24d583afcc9e66dedbc19b /contrib | |
parent | 21da526107a6ff604c66c94780fb2a185feec9e0 (diff) | |
download | gcc-abe95ef6bf44f5e1991b6ad15cd704248b000a27.tar.gz |
mark_spam.py: Mark as spam all comments done by a creator
* mark_spam.py: Mark as spam all comments done by a creator.
From-SVN: r239527
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ChangeLog | 4 | ||||
-rwxr-xr-x | contrib/mark_spam.py | 20 |
2 files changed, 16 insertions, 8 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 16ea455b2cf..d2286e52e53 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2016-08-17 Martin Liska <mliska@suse.cz> + + * mark_spam.py: Mark as spam all comments done by a creator. + 2016-08-15 Martin Liska <mliska@suse.cz> * mark_spam.py: Add error handling and reset diff --git a/contrib/mark_spam.py b/contrib/mark_spam.py index f206356ba6e..86f46a129cc 100755 --- a/contrib/mark_spam.py +++ b/contrib/mark_spam.py @@ -39,7 +39,9 @@ def mark_as_spam(id, api_key, verbose): return # 2) mark the bug as spam - cc_list = response['bugs'][0]['cc'] + bug = response['bugs'][0] + creator = bug['creator'] + cc_list = bug['cc'] data = { 'status': 'RESOLVED', 'resolution': 'INVALID', @@ -64,13 +66,15 @@ def mark_as_spam(id, api_key, verbose): # 3) mark the first comment as spam r = requests.get(u + '/comment') response = json.loads(r.text) - comment_id = response['bugs'][str(id)]['comments'][0]['id'] - - u2 = '%sbug/comment/%d/tags' % (base_url, comment_id) - r = requests.put(u2, json = {'comment_id': comment_id, 'add': ['spam'], 'api_key': api_key}) - if verbose: - print(r) - print(r.text) + for c in response['bugs'][str(id)]['comments']: + if c['creator'] == creator: + comment_id = c['id'] + u2 = '%sbug/comment/%d/tags' % (base_url, comment_id) + print(u2) + r = requests.put(u2, json = {'comment_id': comment_id, 'add': ['spam'], 'api_key': api_key}) + if verbose: + print(r) + print(r.text) # 4) mark all attachments as spam r = requests.get(u + '/attachment') |