本文整理匯總了Python中http.server.SimpleHTTPRequestHandler.end_headers方法的典型用法代碼示例。如果您正苦於以下問題:Python SimpleHTTPRequestHandler.end_headers方法的具體用法?Python SimpleHTTPRequestHandler.end_headers怎麽用?Python SimpleHTTPRequestHandler.end_headers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類http.server.SimpleHTTPRequestHandler
的用法示例。
在下文中一共展示了SimpleHTTPRequestHandler.end_headers方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Headers', 'x-request-timestamp, x-signature, electricitymap-token')
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
self.send_header('Pragma', 'no-cache')
self.send_header('Expires', '0')
SimpleHTTPRequestHandler.end_headers(self)
示例2: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers(self):
response_headers = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query).get('response_headers')
if response_headers:
headers = json.loads(response_headers[0])
for header, value in headers:
self.send_header(header, value)
return SimpleHTTPRequestHandler.end_headers(self)
示例3: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
示例4: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers(self):
self.gzip_headers()
SimpleHTTPRequestHandler.end_headers(self)
示例5: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Methods', 'GET')
self.send_header('Access-Control-Allow-Headers', '*')
self.send_header('Access-Control-Allow-Headers', 'Pragma,Cache-Control,If-Modified-Since,Content-Type,X-Requested-With,X-stream,X-Ajax-Browser-Auth')
SimpleHTTPRequestHandler.end_headers(self)
示例6: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers(self):
self.send_header("Access-Control-Allow-Origin","*")
self.send_header("Access-Control-Allow-Headers", "Content-Type")
SimpleHTTPRequestHandler.end_headers(self)
示例7: end_headers
# 需要導入模塊: from http.server import SimpleHTTPRequestHandler [as 別名]
# 或者: from http.server.SimpleHTTPRequestHandler import end_headers [as 別名]
def end_headers(self):
self.send_my_headers()
SimpleHTTPRequestHandler.end_headers(self)