Content-type: text/plain for errors or status messages
This commit is contained in:
parent
1c061783b4
commit
1ba38a5c9c
@ -64,10 +64,10 @@ def add_account(env, start_response):
|
||||
use_tor = False
|
||||
|
||||
if _add_account(parameters['username'][0], parameters['password'][0], save_account, use_tor ):
|
||||
start_response('200 OK', () )
|
||||
start_response('200 OK', [('Content-type', 'text/plain'),] )
|
||||
return b'Account successfully added'
|
||||
else:
|
||||
start_response('200 OK', () )
|
||||
start_response('200 OK', [('Content-type', 'text/plain'),] )
|
||||
return b'Failed to add account'
|
||||
|
||||
def get_account_login_page(env, start_response):
|
||||
|
@ -402,7 +402,7 @@ def get_channel_page(env, start_response):
|
||||
|
||||
result = channel_search_page(polymer_json, query, page_number, number_of_videos, env['QUERY_STRING'])
|
||||
else:
|
||||
start_response('404 Not Found', ())
|
||||
start_response('404 Not Found', [('Content-type', 'text/plain'),])
|
||||
return b'Unknown channel tab: ' + tab.encode('utf-8')
|
||||
|
||||
start_response('200 OK', [('Content-type','text/html'),])
|
||||
@ -423,7 +423,7 @@ def get_channel_page_general_url(env, start_response):
|
||||
page = 'videos'
|
||||
base_url = 'https://www.youtube.com/' + '/'.join(path_parts)
|
||||
else:
|
||||
start_response('404 Not Found', ())
|
||||
start_response('404 Not Found', [('Content-type', 'text/plain'),])
|
||||
return b'Invalid channel url'
|
||||
|
||||
if page == 'videos':
|
||||
@ -446,7 +446,7 @@ def get_channel_page_general_url(env, start_response):
|
||||
polymer_json = json.loads(polymer_json)
|
||||
return channel_search_page('''
|
||||
else:
|
||||
start_response('404 Not Found', ())
|
||||
start_response('404 Not Found', [('Content-type', 'text/plain'),])
|
||||
return b'Unknown channel page: ' + page.encode('utf-8')
|
||||
|
||||
start_response('200 OK', [('Content-type','text/html'),])
|
||||
|
@ -155,7 +155,7 @@ def path_edit_playlist(env, start_response):
|
||||
return b''
|
||||
|
||||
else:
|
||||
start_response('400 Bad Request', ())
|
||||
start_response('400 Bad Request', [('Content-type', 'text/plain'),])
|
||||
return b'400 Bad Request'
|
||||
|
||||
def edit_playlist(env, start_response):
|
||||
@ -165,5 +165,5 @@ def edit_playlist(env, start_response):
|
||||
add_to_playlist(parameters['playlist_name'][0], parameters['video_info_list'])
|
||||
start_response('204 No Content', ())
|
||||
else:
|
||||
start_response('400 Bad Request', ())
|
||||
start_response('400 Bad Request', [('Content-type', 'text/plain'),])
|
||||
return b'400 Bad Request'
|
||||
|
@ -231,7 +231,7 @@ music_list_table_row = Template('''<tr>
|
||||
def get_watch_page(env, start_response):
|
||||
video_id = env['parameters']['v'][0]
|
||||
if len(video_id) < 11:
|
||||
start_response('404 Not Found', ())
|
||||
start_response('404 Not Found', [('Content-type', 'text/plain'),])
|
||||
return b'Incomplete video id (too short): ' + video_id.encode('ascii')
|
||||
|
||||
start_response('200 OK', [('Content-type','text/html'),])
|
||||
|
@ -75,11 +75,11 @@ def youtube(env, start_response):
|
||||
return f.read().replace(b'$port_number', str(settings.port_number).encode())
|
||||
|
||||
elif path == "/comment_delete_success":
|
||||
start_response('200 OK', () )
|
||||
start_response('200 OK', [('Content-type', 'text/plain'),] )
|
||||
return b'Successfully deleted comment'
|
||||
|
||||
elif path == "/comment_delete_fail":
|
||||
start_response('200 OK', () )
|
||||
start_response('200 OK', [('Content-type', 'text/plain'),] )
|
||||
return b'Failed to deleted comment'
|
||||
|
||||
else:
|
||||
@ -97,9 +97,9 @@ def youtube(env, start_response):
|
||||
else:
|
||||
return handler(env, start_response)
|
||||
|
||||
start_response('404 Not Found', ())
|
||||
start_response('404 Not Found', [('Content-type', 'text/plain'),])
|
||||
return b'404 Not Found'
|
||||
|
||||
else:
|
||||
start_response('501 Not Implemented', ())
|
||||
start_response('501 Not Implemented', [('Content-type', 'text/plain'),])
|
||||
return b'501 Not Implemented'
|
||||
|
Loading…
x
Reference in New Issue
Block a user