我的Python自学之路

Python 学习笔记 101

2020-01-29  本文已影响0人  夜羽萧轩

python http 模组

http is a package that collects several modules for working with the HyperText Transfer Protocol:

    http.client is a low-level HTTP protocol client; for high-level URL opening use urllib.request
    http.server contains basic HTTP server classes based on socketserver
    http.cookies has utilities for implementing state management with cookies
    http.cookiejar provides persistence of cookies

1.HyperText Transfer Protocol: http协议 超链接文本传输协议 (自己看懂的,应该就是这样的!)
2.http.client 低级http协议客户端
高级使用urllib.request
3.http.server包含基于socketserver的基本HTTP服务器类
没看懂 pass
4.下面是关于cookies的一些介绍 关于cookies的持久性&一些常见组件

http is also a module that defines a number of HTTP status codes and associated messages through the http.HTTPStatus enum:

5.定义了http返回的状态码:

code:
from http import HTTPStatus

HTTPStatus.ACCEPTED

http客户端编程一般用urllib.request库

主要用于“在这复杂的世界里打开各种url”,包括:authentication、redirections、cookies and more

http库中的函数

urllib.request.urlopen(url, data=None, [timeout, ]*, cafile=None, capath=None, cadefault=False, context=None)     

urllib.request.install_opener(opener)     

urllib.request.build_opener([handler, ...])     

urllib.request.pathname2url(path)        

urllib.request.url2pathname(path)    

urllib.request.getproxies()    

未完待续
2020年1月19日21:58:10

上一篇 下一篇

猜你喜欢

热点阅读