博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python urllib2 开启调试
阅读量:6981 次
发布时间:2019-06-27

本文共 723 字,大约阅读时间需要 2 分钟。

hot3.png

发一段在网上看见.

USING HTTPLIB.HTTPCONNECTION.SET_DEBUGLEVEL() WITH URLLIB2

Posted on October 1, 2007, 9:52 pm, by jamiegrove, under  .

I’ve been trying to get the debug level turned on in urllib2 for about an hour and now that it is working I thought I would post what I found… :)

When using urllib, you can set the debuglevel directly by using something like this:

import urllib, httplib

httplib.HTTPConnection.debuglevel = 1

urllib.urlopen(“http://www.somesite.com”)

However, when using urllib2 you need to create a handler install it for use. The sample below creates the lovely debuglevel handler.

import urllib2

h=urllib2.HTTPHandler(debuglevel=1)
opener = urllib2.build_opener(h)

转载于:https://my.oschina.net/u/195896/blog/110305

你可能感兴趣的文章
脚本语言程序员怎么学习程序设计?
查看>>
网络嗅探软件全接触(2)
查看>>
Redis中的关系查询(范围查询,模糊查询等...)
查看>>
Phalcon入门教程之模型CURD(2)
查看>>
四川成立大数据发展研究会 拟建公共云暨数据交易中心
查看>>
安全公司发现针对印度外交部与军事机构的间谍活动
查看>>
无接口.NET代码的单元测试
查看>>
数据库产品如何选型
查看>>
日本外务省新设网络安全保障政策室
查看>>
美“智能城市挑战赛”决赛名单公布:7座城市入围
查看>>
企业全光网将成运营商部署千兆接入的商业驱动力
查看>>
2030年实现全球10TW的光伏目标 太阳能电池需要哪些突破?
查看>>
2017年物联网五大趋势
查看>>
流量劫持已成行业毒瘤,不正当竞争当严惩
查看>>
最让程序员懊恼的 10 件事
查看>>
Iframe高度自适应(兼容IEFirefox、同域跨域)
查看>>
Google 工程师如何发现 Heartbleed 漏洞
查看>>
《Python面向对象编程指南》——2.8 __new__()方法和不可变对象
查看>>
ROS机器人程序设计(原书第2版)第1章 ROS Hydro系统入门
查看>>
《Android平板电脑开发秘籍》——3.9节技巧:创建一个下拉列表式的ActionBar
查看>>