V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
flyer103
V2EX  ›  Python

QtWebKit 中,如何在超时后关闭某个 http 请求?

  •  
  •   flyer103 · 2012-10-26 10:12:18 +08:00 · 4481 次点击
    这是一个创建于 4206 天前的主题,其中的信息可能已经有所发展或是发生改变。
    使用 QtWebKit 中,可以发现在通过 QWebPage().mainFrame().load(QUrl(url)) 后,会有很多请求自动发送,如请求 js、css 文件等。那么该如何设置每个请求的等待时间,当请求超时时,关闭超时的 js、css 等请求?

    我觉得可以在 QNetworkAccessManager 的子类中设置,通过 QNetworkReply 的 abort() 方法放弃某个发送过的 http 请求,但没找到合适的方法来获得 QNetworkReply 对象来使用 abort() 方法。另外,使用 QTimer 设置超时的 slot 时,该如何向 slot 传递自定义的参数?如果这个问题能解决,我觉得就可以在 QTimer 设置的超时的 slot 中传入 QNetworkReply 对象来实现我想要的功能。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2366 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:56 · PVG 20:56 · LAX 05:56 · JFK 08:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.