def headers_cb():
 headers = {'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': ((('accept, accept-charset, accept-encoding, ' + 'accept-language, authorization, content-length, ') + 'content-type, host, origin, proxy-connection, ') + 'referer, user-agent, x-requested-with'), 'Access-Control-Allow-Methods': 'HEAD, GET, PUT, POST, PATCH, DELETE', 'Access-Control-Allow-Origin': '*', 'Access-Control-Max-Age': '86400'}
 if add_headers_cb:
  headers.update(add_headers_cb())
 return headers

def headers_cb ( ) : headers = { 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : ( ( ( 'accept, accept-charset, accept-encoding, ' + 'accept-language, authorization, content-length, ' ) + 'content-type, host, origin, proxy-connection, ' ) + 'referer, user-agent, x-requested-with' ) , 'Access-Control-Allow-Methods' : 'HEAD, GET, PUT, POST, PATCH, DELETE' , 'Access-Control-Allow-Origin' : '*' , 'Access-Control-Max-Age' : '86400' } if add_headers_cb : headers . update ( add_headers_cb ( ) ) return headers
callback method for providing headers per request add_headers_cb is another callback providing headers to update the defaults in this method .