python学习第一课 requests

时间:2022-03-23 22:16:02

使用requests 进行网络请求很简单,第一步,导入requests
import requests
r=requests.get('https://github.com/timeline.json')
也可以传递参数:
para = {'key1':'key1','key2':'key2'}r = requests.get('https://github.com/timeline.json',para)
>>> r = requests.put("http://httpbin.org/put")>>> r = requests.delete("http://httpbin.org/delete")>>> r = requests.head("http://httpbin.org/get")>>> r = requests.options("http://httpbin.org/get")