urllib.urlopen.read文件()不显示来自pag的最新信息

2024-09-30 08:14:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从给定的网页上阅读信息,但是urllib.urlopen.read文件()不接收在以下时间的最后几个小时内所做的任何更改urllib.urlopen.read文件()已运行。你知道吗

Heres my code:

import urllib2

url_latest = ('http://panoptic-fearless.ldc.yougov.net/questionnaires/Test_maj_demo_newG4_2/versions/')

versions = urllib2.urlopen(url_latest)

print versions.info()['date']

html = versions.read()

print html

这把所有的东西都打印在纸上,这很好。但是如果最近有什么变化,这个脚本就不能显示出来。你知道吗

如果我在chrome中手动插入此url,我可以看到此网页的最新信息:

http://panoptic-fearless.ldc.yougov.net/questionnaires/Test_maj_demo_newG4_2/versions/ 

知道怎么回事吗?如何访问网页的最新版本?你知道吗

抱歉,如果我有我的一些条款错误我仍然失败新的编程世界。你知道吗

解决了。你知道吗

信息被藏在某个地方。每次调用脚本时,我都必须添加此行以重新验证其缓存条目:

你知道吗版本。添加标题('Cache-Control','max age=0')


Tags: 文件信息httpurl网页readurllib2urllib

热门问题