diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-15 09:30:44 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-15 09:30:44 +0000 |
commit | 5790765518c78737ef7c56d34a62b8e62262734a (patch) | |
tree | ba3bb83814224eee45684a33305eea5aec91a6b1 /contrib | |
parent | 76f627a49eca58cee6e5366661d5bec2bf44d716 (diff) |
Enhance mark_spam.py script
* mark_spam.py: Add error handling and reset
another properties of attachments and bugs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239467 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ChangeLog | 5 | ||||
-rwxr-xr-x | contrib/mark_spam.py | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 6e1a0fc2d7b1..16ea455b2cf7 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2016-08-15 Martin Liska <mliska@suse.cz> + + * mark_spam.py: Add error handling and reset + another properties of attachments and bugs. + 2016-08-11 Martin Liska <mliska@suse.cz> * mark_spam.py: Mark attachments as obsolete and rename them. diff --git a/contrib/mark_spam.py b/contrib/mark_spam.py index 569a03dd9a78..f206356ba6e3 100755 --- a/contrib/mark_spam.py +++ b/contrib/mark_spam.py @@ -34,6 +34,10 @@ def mark_as_spam(id, api_key, verbose): r = requests.get(u) response = json.loads(r.text) + if 'error' in response and response['error']: + print(response['message']) + return + # 2) mark the bug as spam cc_list = response['bugs'][0]['cc'] data = { @@ -49,6 +53,7 @@ def mark_as_spam(id, api_key, verbose): 'cc': {'remove': cc_list}, 'priority': 'P5', 'severity': 'trivial', + 'url': '', 'assigned_to': 'unassigned@gcc.gnu.org' } r = requests.put(u, json = data) @@ -74,7 +79,12 @@ def mark_as_spam(id, api_key, verbose): for a in attachments: attachment_id = a['id'] url = '%sbug/attachment/%d' % (base_url, attachment_id) - r = requests.put(url, json = {'ids': [attachment_id], 'summary': 'spam', 'comment': 'spam', 'is_obsolete': True, 'api_key': api_key}) + r = requests.put(url, json = {'ids': [attachment_id], + 'summary': 'spam', + 'file_name': 'spam', + 'content_type': 'application/x-spam', + 'is_obsolete': True, + 'api_key': api_key}) if verbose: print(r) print(r.text) |