官术网_书友最值得收藏!

There's more...

The headers in a response contain a wealth of information.  If we look more closely at the headers property of the response, we can see the following headers are returned:

>>> response = urllib.request.urlopen(const.ApodEclipseImage())
>>> for header in response.headers: print(header)
Date
Server
Last-Modified
ETag
Accept-Ranges
Content-Length
Connection
Content-Type
Strict-Transport-Security

And we can see the values for each of these headers.

>>> for header in response.headers: print(header + " ==> " + response.headers[header])
Date ==> Tue, 26 Sep 2017 19:31:41 GMT
Server ==> WebServer/1.0
Last-Modified ==> Thu, 31 Aug 2017 20:26:32 GMT
ETag ==> "547bb44-29c06-5581275ce2b86"
Accept-Ranges ==> bytes
Content-Length ==> 171014
Connection ==> close
Content-Type ==> image/jpeg
Strict-Transport-Security ==> max-age=31536000; includeSubDomains

Many of these we will not examine in this book, but for the unfamiliar it is good to know that they exist.

主站蜘蛛池模板: 合江县| 阿城市| 周至县| 涟水县| 泊头市| 阳东县| 额济纳旗| 渭南市| 四平市| 怀集县| 门源| 安平县| 全州县| 井陉县| 株洲县| 汉川市| 美姑县| 贵德县| 隆化县| 克什克腾旗| 永顺县| 鹿邑县| 云南省| 天镇县| 大丰市| 时尚| 永登县| 太白县| 临澧县| 平南县| 林西县| 峨眉山市| 绍兴市| 鄂尔多斯市| 伊宁市| 股票| 大足县| 宁津县| 义乌市| 姚安县| 阳春市|