我在django写了一个api:
class TagDomain(PatchOauth2, APIView):
def post(self, request, *arg, **kwargs):
records = request.POST['data']
for record in records:
pass
在本地,我写了一个tagdomain.py:
def tagdomain():
headers = {"Content-type": "application/json"}
url= "http://127.0.0.1:8000/api/domain/tag_domain/"
par={'data':data}
r = requests.post(url,data=json.dumps(par), headers=headers, auth=('name', 'passwd'))
....
当我运行tagdomain.py时,request.POST为null,我该如何获取数据?
答案 0 :(得分:0)
:records = request.DATA,它可以获取数据