2024-06-26 17:50:09 发布
网友
我对Python非常陌生(对编程也比较陌生),希望能得到任何帮助。你知道吗
如何使用下面的示例链接下载使用Python提供的信息。你知道吗
https://url.com/InfoService/GetFlightByFlightNum?board={BOARD}&flightNum={flightNum}
方法:GET
谢谢
您可以使用内置库urllib2。你知道吗
Python2文档:http://docs.python.org/2/library/urllib2.html
python3文档:http://docs.python.org/3.1/howto/urllib2.html
下面是一些例子:How do I download a file over HTTP using Python?
从python访问api最简单的方法是使用requests库
您可以使用pip install requests快速安装它
pip install requests
然后你可以这样做作为你的例子:
import requests payload = {'board': {BOARD}, 'flightNum': {FLIGHTNUM}} r = requests.get('https://url.com/InfoService/GetFlightByFlightNum', params=payload) # print the response result print r.text
您可以使用内置库urllib2。你知道吗
Python2文档:http://docs.python.org/2/library/urllib2.html
python3文档:http://docs.python.org/3.1/howto/urllib2.html
下面是一些例子:How do I download a file over HTTP using Python?
从python访问api最简单的方法是使用requests库
您可以使用
pip install requests
快速安装它然后你可以这样做作为你的例子:
相关问题 更多 >
编程相关推荐