首页 > Web开发 > 详细

bs4爬虫处理解析html代码,获得属性,获取crsf认证,事件数据插入失败回滚,# 局部禁用csrf认证,处理时间

时间:2019-03-22 21:16:27      阅读:250      评论:0      收藏:0      [点我收藏+]
获得属性

var username = $(this).attr(‘username‘)
获取crsf认证
token = $(‘[name=csrfmiddlewaretoken]‘).val()
data:{‘is_up‘:1,csrfmiddlewaretoken: token},
事件数据插入失败回滚
from django.db import transaction
try:
with transaction.atomic():
except:
# 局部禁用csrf认证
from django.views.decorators.csrf import csrf_exempt, csrf_protect
处理时间
from django.db.models.functions import TruncMonth
time_list = user.blog.article_set.annotate(month=TruncMonth(‘create_time‘)).values(‘month‘).annotate(
c=Count(‘title‘))


# bs4爬虫处理解析html代码
from bs4 import BeautifulSoup
soup = BeautifulSoup(content, ‘html.parser‘)
desc = soup.text.strip()[0:100]
 

bs4爬虫处理解析html代码,获得属性,获取crsf认证,事件数据插入失败回滚,# 局部禁用csrf认证,处理时间

原文:https://www.cnblogs.com/wrqysrt/p/10580867.html

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