本文整理匯總了Python中werkzeug.Response.headers["Content-Disposition"]方法的典型用法代碼示例。如果您正苦於以下問題:Python Response.headers["Content-Disposition"]方法的具體用法?Python Response.headers["Content-Disposition"]怎麽用?Python Response.headers["Content-Disposition"]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類werkzeug.Response
的用法示例。
在下文中一共展示了Response.headers["Content-Disposition"]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __call__
# 需要導入模塊: from werkzeug import Response [as 別名]
# 或者: from werkzeug.Response import headers["Content-Disposition"] [as 別名]
def __call__(self, env, start_response):
Config = ConfigParser()
Config.read(configfile)
params = {"host": "", "user": "", "database": "", "port": ""}
for param in params:
if not Config.has_option("BlobStore", param):
print "Malformed configuration file: mission option %s in section %s" % (param, "BlobStore")
sys.exit(1)
params[param] = Config.get("BlobStore", param)
req = Request(env)
resp = Response(status=200, content_type="text/plain")
#engine = create_engine("mysql+mysqldb://%s:%[email protected]%s:%s/%s?charset=utf8&use_unicode=0" %
# (params["user"], secret.BlobSecret, params["host"], params["port"], params["database"]), pool_recycle=3600)
Base = declarative_base(bind=engine)
local.Session = []
local.FileEntry = []
Session.append(sessionmaker(bind=engine))
FileEntry.append(makeFileEntry(Base))
if req.path.startswith('/fx'):
if req.method == "GET":
resp.status_code, filename, resp.content_type, resp.response = self.__download(req)
if resp.content_type == "application/octet-stream":
resp.headers["Content-Disposition"] = "attachment; filename=%s" % filename
return resp(env, start_response)
elif req.method == "POST":
resp.content_type="text/plain"
resp.response = self.__upload(req)
return resp(env, start_response)
else:
resp.status_code = 404
resp.content_type="text/plain"
resp.response = ""
return resp(env, start_response)