本文整理汇总了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)