国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Django Python 獲取請求頭信息Content-Range

2019-11-06 06:06:50
字體:
來源:轉載
供稿:網友

request請求頭信息的鍵會加上HTTP_轉換成大寫存到request.META中

因此你只需要

content_range = request.META['HTTP_CONTENT_RANGE']

這樣就可以獲取到Content-Range的信息。

django官網的解釋:

A standard Python dictionary containing all available HTTP headers. Available headers depend on the client and server, but here are some examples:

CONTENT_LENGTH – The length of the request body (as a string).CONTENT_TYPE – The MIME type of the request body.HTTP_ACCEPT – Acceptable content types for the response.HTTP_ACCEPT_ENCODING – Acceptable encodings for the response.HTTP_ACCEPT_LANGUAGE – Acceptable languages for the response.HTTP_HOST – The HTTP Host header sent by the client.HTTP_REFERER – The referring page, if any.HTTP_USER_AGENT – The client’s user-agent string.QUERY_STRING – The query string, as a single (unparsed) string.REMOTE_ADDR – The ip address of the client.REMOTE_HOST – The hostname of the client.REMOTE_USER – The user authenticated by the Web server, if any.REQUEST_METHOD – A string such as "GET" or "POST".SERVER_NAME – The hostname of the server.SERVER_PORT – The port of the server (as a string).

With the exception of CONTENT_LENGTH and CONTENT_TYPE, as given above, any HTTP headers in the request are converted to META keys by converting all characters to uppercase, replacing any hyphens with underscores and adding an HTTP_ PRefix to the name. So, for example, a header called X-Bender would be mapped to the META key HTTP_X_BENDER.

很多同學在找Content-Range的時候發現文檔中沒有這個,所以以為不支持這個,一直再找。百度 Google什么的

但是其實這個文檔只是列出的其中一部分,而且他們沒細心的讀A standard Python dictionary containing all available HTTP headers,這一句,同時上面的也只是一部分例子,因此在看文檔的時候,希望同學們能細心一點!


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 凌海市| 西峡县| 环江| 托里县| 彭阳县| 昌吉市| 巴彦县| 尖扎县| 蒙阴县| 平乐县| 伊宁市| 和林格尔县| 定安县| 开封市| 宁南县| 两当县| 兴业县| 临高县| 涟水县| 临汾市| 马边| 健康| 威海市| 隆子县| 敦化市| 兰西县| 剑川县| 屯留县| 广水市| 广平县| 星子县| 上思县| 绵竹市| 丹凤县| 辽源市| 施甸县| 泸州市| 鹿邑县| 大丰市| 定安县| 文水县|