Python Request-学习笔记(1)

#导入Requests模块:
import requests

# 然后,尝试获取某个网页。返回的是reaponse对象,可以从这个对象中获取所有我们想要的信息。
response = requests.get('https://github.com/timeline.json')
# Requests简便的API意味着所有HTTP请求类型都是显而易见的。例如,你可以这样发送一个HTTP POST请求:
r = requests.post("http://httpbin.org/post")
#HTTP请求类型:PUT, DELETE, HEAD以及OPTIONS
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")
原文地址:https://www.cnblogs.com/zijiyanxi/p/5230842.html