-
章节
2-2
查看全部 -
here play
查看全部 -
session和cookie机制
查看全部 -
cookie
查看全部 -
oauth认证
查看全部 -
Request课程路线图
查看全部 -
import json,requests
URL = 'https://api.github.com'
def build_uri(endpoint):
return '/'.join([URL,endpoint]) #join的使用?
def better_print(json_str): #文本输出格式统一 json的使用?
return json.dumps(json.loads(json_str),indent = 4)
def request_method():
response = requests.get(build_uri('users/imoocdemo'))
print(better_print(response.text))
if __name__ == '__main__': # ==
request_method()
查看全部 -
json 文书输出
查看全部 -
get: 查看资源
post:增加资源
put: 修改资源
delete:删除资源
head:查看响应头
查看全部 -
reaponse = requests.get("http://www.baidu.com") # 获取get请求 print(response.headers) # 获取请求头
print(response.status_code) #获得返回状态
print(response.text) # 获取请求页面内容
查看全部 -
Session和Cookies
查看全部 -
requests中获取状态码
status_code
查看全部 -
认识Requests类库
查看全部 -
response.text 获取响应的body内容
代码链接
https://github.com/jian-en/imooc-requests
查看全部 -
安装环境准备
查看全部
举报