【问题标题】:Django PatchOauth2 request.POST get noneDjango PatchOauth2 request.POST 没有
【发布时间】:2015-09-15 10:16:16
【问题描述】:

我在 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 为空,我如何获取数据?

【问题讨论】:

    标签: python django oauth request


    【解决方案1】:

    在django中:records = request.DATA,可以获取数据

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-18
      • 2021-01-22
      • 1970-01-01
      • 2022-01-15
      • 2015-04-17
      • 2012-02-18
      • 1970-01-01
      相关资源
      最近更新 更多