diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-01-05 01:57:50 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-01-05 01:57:50 -0800 |
commit | 28270a9ce83c4cf53a950de913e3e635c9ac1139 (patch) | |
tree | 2bb01c1d0f5ec0a7342523c6afbe7065ba67e144 /youtube/post_comment.py | |
parent | 60df0aec6d76ddda5a62ca855857f6e6573589fa (diff) | |
download | yt-local-28270a9ce83c4cf53a950de913e3e635c9ac1139.tar.lz yt-local-28270a9ce83c4cf53a950de913e3e635c9ac1139.tar.xz yt-local-28270a9ce83c4cf53a950de913e3e635c9ac1139.zip |
WSGI for /delete_comment (POST request)
Diffstat (limited to 'youtube/post_comment.py')
-rw-r--r-- | youtube/post_comment.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube/post_comment.py b/youtube/post_comment.py index fc4d4b1..5166b6c 100644 --- a/youtube/post_comment.py +++ b/youtube/post_comment.py @@ -109,11 +109,18 @@ def get_session_token(video_id, cookiejar): else: raise Exception("Couldn't find xsrf_token") -def delete_comment(parameters, fields): +def delete_comment(env, start_response): + fields = env['fields'] video_id = fields['video_id'][0] cookiejar = accounts.account_cookiejar(fields['channel_id'][0]) token = get_session_token(video_id, cookiejar) - return _delete_comment(video_id, fields['comment_id'][0], fields['author_id'][0], token, cookiejar) + + code = _delete_comment(video_id, fields['comment_id'][0], fields['author_id'][0], token, cookiejar) + + if code == "SUCCESS": + start_response('303 See Other', [('Location', common.URL_ORIGIN + '/comment_delete_success'),] ) + else: + start_response('303 See Other', [('Location', common.URL_ORIGIN + '/comment_delete_fail'),] ) def post_comment(parameters, fields): channel_id = fields['channel_id'][0] |