• 之前写回调地址做的笔记


    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))
    

      

  • 相关阅读:
    Restful API
    Vue之指令
    Scrapy框架
    爬虫提高性能:串行、线程进程、异步非阻塞
    MongoDB
    Beautifulsoup模块
    请求库之selenium
    php 正则匹配中文
    Javascript的"预编译"思考
    PHP程序员面试技巧之口试题分享
  • 原文地址:https://www.cnblogs.com/chenadong/p/10633980.html
Copyright © 2020-2023  润新知