国产探花免费观看_亚洲丰满少妇自慰呻吟_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,這一句,同時上面的也只是一部分例子,因此在看文檔的時候,希望同學們能細心一點!


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 彩票| 长武县| 九台市| 东兰县| 永城市| 炉霍县| 永定县| 静乐县| 榆中县| 饶河县| 三都| 高碑店市| 晋宁县| 合水县| 高碑店市| 井陉县| 乌审旗| 保德县| 丹寨县| 湄潭县| 普定县| 开化县| 大兴区| 武义县| 广元市| 梅河口市| 襄汾县| 龙井市| 汕头市| 平罗县| 土默特右旗| 龙门县| 高台县| 天祝| 抚宁县| 湄潭县| 福海县| 沈丘县| 类乌齐县| 东辽县| 福建省|