下载资源后端资源详情
request库练习.zip
大小:42.06KB
价格:10积分
下载量:0
评分:
5.0
上传者:weixin_61319245
更新日期:2024-08-28

request库练习代码

资源文件列表(大概)

文件名
大小
request库练习/.git/
-
request库练习/.git/config
309B
request库练习/.git/description
73B
request库练习/.git/HEAD
23B
request库练习/.git/hooks/
-
request库练习/.git/hooks/applypatch-msg.sample
478B
request库练习/.git/hooks/commit-msg.sample
896B
request库练习/.git/hooks/fsmonitor-watchman.sample
4.62KB
request库练习/.git/hooks/post-update.sample
189B
request库练习/.git/hooks/pre-applypatch.sample
424B
request库练习/.git/hooks/pre-commit.sample
1.6KB
request库练习/.git/hooks/pre-merge-commit.sample
416B
request库练习/.git/hooks/prepare-commit-msg.sample
1.46KB
request库练习/.git/hooks/pre-push.sample
1.34KB
request库练习/.git/hooks/pre-rebase.sample
4.78KB
request库练习/.git/hooks/pre-receive.sample
544B
request库练习/.git/hooks/push-to-checkout.sample
2.72KB
request库练习/.git/hooks/sendemail-validate.sample
2.25KB
request库练习/.git/hooks/update.sample
3.56KB
request库练习/.git/index
1.85KB
request库练习/.git/info/
-
request库练习/.git/info/exclude
240B
request库练习/.git/logs/
-
request库练习/.git/logs/HEAD
189B
request库练习/.git/logs/refs/
-
request库练习/.git/logs/refs/heads/
-
request库练习/.git/logs/refs/heads/master
189B
request库练习/.git/logs/refs/remotes/
-
request库练习/.git/logs/refs/remotes/origin/
-
request库练习/.git/logs/refs/remotes/origin/HEAD
189B
request库练习/.git/objects/
-
request库练习/.git/objects/info/
-
request库练习/.git/objects/pack/
-
request库练习/.git/objects/pack/pack-363343e641256dd2cce6721d1a8309e158712e4f.idx
1.79KB
request库练习/.git/objects/pack/pack-363343e641256dd2cce6721d1a8309e158712e4f.pack
10.11KB
request库练习/.git/objects/pack/pack-363343e641256dd2cce6721d1a8309e158712e4f.rev
160B
request库练习/.git/packed-refs
114B
request库练习/.git/refs/
-
request库练习/.git/refs/heads/
-
request库练习/.git/refs/heads/master
41B
request库练习/.git/refs/remotes/
-
request库练习/.git/refs/remotes/origin/
-
request库练习/.git/refs/remotes/origin/HEAD
32B
request库练习/.git/refs/tags/
-
request库练习/.git/sourcetreeconfig.json
781B
request库练习/DELETE请求.py
332B
request库练习/GET带参.py
519B
request库练习/GET请求.py
223B
request库练习/POST请求.py
682B
request库练习/POST请求扩展(data与json区别).py
1005B
request库练习/POST请求扩展(响应对象.text和.json的区别).py
854B
request库练习/PUT请求.py
695B
request库练习/练习/
-
request库练习/练习/code.jpg
12.24KB
request库练习/练习/code.png
1.35KB
request库练习/练习/查询我的订单.py
938B
request库练习/练习/查询我的订单_session.py
958B
request库练习/响应对象方法.py
664B

资源内容介绍

request库练习代码
# 请求地址:http:127.0.0.1:8000/api/departments/# 请求信息头:Content-Type: application/jsonimport json# json格式# 导包import requests# 调用Post方法# 请求urlurl = 'http:127.0.0.1:8000/api/departments/'# 请求headersheaders = {'Content-Type': 'application/json'}# 请求jsondata = { "data": [ { "dep_id": "TT701", "dep_name": "Test学院", "slogan": "Test-Master", "master_nane": "Here is Slogan" } ]}# json使用 ---> 成功# response = requests.post(url,json=data,headers=headers)# data使用 ---> 失败 注意:对于python字典和json一样,但数据序列化格式还是有一定的区别# response = requests.post(url,data=data,headers=headers)# 将字典转换为json字符串response = requests.post(url,data=json.dump(data),headers=headers)# 获取响应对象print(response.json())# 获取响应状态码print(response.status_code)

用户评论 (0)

发表评论

captcha