What is the quickest way to HTTP GET in Python if I know the content will be a string?
(如果我知道内容将是字符串,那么用Python进行HTTP GET的最快方法是什么?)
I am searching the documentation for a quick one-liner like: (我正在搜索文档,以查找像以下这样的快速单行代码:)
contents = url.get("http://example.com/foo/bar")
But all I can find using Google are httplib
and urllib
- and I am unable to find a shortcut in those libraries.
(但是我可以使用Google找到的只是httplib
和urllib
我无法在这些库中找到快捷方式。)
Does standard Python 2.5 have a shortcut in some form as above, or should I write a function url_get
?
(标准Python 2.5是否具有上述某种形式的快捷方式,还是应该编写url_get
函数?)
- I would prefer not to capture the output of shelling out to
wget
or curl
. (我宁愿不要捕获脱壳输出到wget
或curl
的输出。)
ask by Frank Krueger translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…