首页 > Web开发 > 详细

urllib.request

时间:2016-08-22 22:58:06      阅读:387      评论:0      收藏:0      [点我收藏+]

urllib.request

1、urlopen结果保存在内存。

  技术分享

2、ulrretrieve结果保存到文件。

  技术分享

3、response有read方法。

  技术分享

4、可以创建Request对象。

  技术分享

5、发送Post数据,需要encode()成ascii的byte.

  技术分享

6、url中加入query

  技术分享

7、加入User-Agent参数。

  技术分享

8、错误。

  urlopen raises URLError when it cannot handle a response (though as usual with Python APIs, built-in exceptions such as ValueError, TypeError etc. may also be raised).

  HTTPError is the subclass of URLError raised in the specific case of HTTP URLs.

  The exception classes are exported from the urllib.error module.

  技术分享

9、http.server.BaseHTTPRequestHandler.responses is a useful dictionary of response codes in that shows all the response codes used by RFC 2616. The dictionary is reproduced here for convenience

  包含所有的HTTP错误码。

  技术分享

 

urllib.request

原文:http://www.cnblogs.com/tekkaman/p/5797141.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!