使用python和xm的curl命令

2024-09-29 22:32:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在python中转换以下命令。在

curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET "https://api.globalgiving.org/api/public/projectservice/all/projects/ids?api_key=YOUR_API_KEY"

Tags: httpsorg命令projectapigetapplicationtype
2条回答

我不是唯一一个建议使用伟大的HTTP for Humans库的人,这个库名为requests。在

安装它:

$ pip install requests

使用方法如下:

^{pr2}$

试试这个:

import urllib

website = urllib.urlopen('http://www.google.com/') 
siteData = website.read()
print siteData

可能会有帮助。在

相关问题 更多 >

    热门问题