Skip to content

Commit 296c90a

Browse files
committed
调整“网络 / 标准的应用层”的下级分类
1 parent aec226f commit 296c90a

1 file changed

Lines changed: 36 additions & 24 deletions

File tree

libs/python.wiki

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,39 @@ Python 标准库很早就提供了对 socket 编程的支持。
598598

599599
== 5.3 标准的应用层 ==
600600

601+
=== 5.3.1 综合性的库 ===
602+
603+
<h4>PycURL</h4>
604+
605+
Home:[http://pycurl.sourceforge.net/]
606+
607+
[https://en.wikipedia.org/wiki/Curl cURL] 是一个功能很强的网络库/网络工具,支持 N 多应用层协议。俺在前几年写过一篇博文推荐它(在“[http://program-think.blogspot.com/2009/03/opensource-review-curl-library.html 这里]”)。
608+
609+
看名称就能猜到——PycURL 是 cURL 的 Python 封装。
610+
611+
代码示例——发起 HTTP GET 请求
612+
<source lang="python">
613+
import pycurl
614+
try :
615+
from io import BytesIO
616+
except ImportError :
617+
from StringIO import StringIO as BytesIO
618+
619+
buffer = BytesIO()
620+
curl = pycurl.Curl()
621+
curl.setopt(curl.URL, "http://pycurl.sourceforge.net/")
622+
curl.setopt(curl.WRITEDATA, buffer)
623+
curl.perform()
624+
curl.close()
625+
body = buffer.getvalue()
626+
</source>
627+
628+
=== 5.3.2 HTTP ===
629+
630+
(关于“HTTP 协议”,请参见另一个大类:“Web”)
631+
632+
=== 5.3.3 FTP ===
633+
601634
<h4>ftplib</h4>
602635

603636
封装 FTP 协议(文件传输)的标准库
@@ -613,6 +646,8 @@ ftp.retrlines("LIST") &#35; 列出当前目录的内容
613646
ftp.quit()
614647
</source>
615648

649+
=== 5.3.4 Email ===
650+
616651
<h4>smtplib</h4>
617652

618653
封装 SMTP 协议(邮件发送)的标准库
@@ -625,30 +660,7 @@ ftp.quit()
625660

626661
封装 POP3 协议(邮件接收)的标准库
627662

628-
<h4>PycURL</h4>
629-
630-
Home:[http://pycurl.sourceforge.net/]
631-
632-
[https://en.wikipedia.org/wiki/Curl cURL] 是一个功能很强的网络库/网络工具,支持 N 多应用层协议。俺在前几年写过一篇博文推荐它(在“[http://program-think.blogspot.com/2009/03/opensource-review-curl-library.html 这里]”)。
633-
634-
看名称就能猜到——PycURL 是 cURL 的 Python 封装。
635-
636-
代码示例——发起 HTTP GET 请求
637-
<source lang="python">
638-
import pycurl
639-
try :
640-
from io import BytesIO
641-
except ImportError :
642-
from StringIO import StringIO as BytesIO
643-
644-
buffer = BytesIO()
645-
curl = pycurl.Curl()
646-
curl.setopt(curl.URL, "http://pycurl.sourceforge.net/")
647-
curl.setopt(curl.WRITEDATA, buffer)
648-
curl.perform()
649-
curl.close()
650-
body = buffer.getvalue()
651-
</source>
663+
=== 5.3.5 IM ===
652664

653665
<h4>jabber.py</h4>
654666

0 commit comments

Comments
 (0)