首页 > 其他 > 详细

之前写回调地址做的笔记

时间:2019-04-01 01:14:44      阅读:180      评论:0      收藏:0      [点我收藏+]
from django.shortcuts import HttpResponse
from django.views.decorators.csrf import csrf_exempt

# Create your views here.

import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
msg_success = {"result": 1, "success": 1}


@csrf_exempt
# 装饰器的作用是取消不需要禁跨站请求
def imagcallback(request):
	request.encoding = "utf-8"
	if request.POST:
		logger.info("================================================================")
		logger.info("a:          %s" % request.POST.dict())
		# request.POST和request.GET都是QueryDict()的实例,可以用过request.POST["key"]获取值;
		# 但是,query dict 类型的数据并不是字段,这里直接调用该对象的方法,转化为dict类型,方便后面操作
		logger.info("================================================================")
	return HttpResponse(str(msg_success))

  

之前写回调地址做的笔记

原文:https://www.cnblogs.com/chenadong/p/10633980.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!