摘要: 下一页和详情页的处理 xpath提取时 注意: 结合网页源代码一起查找 不用框架的爬取 获取下一页 自带href属性 1)首页有下一页 next_url = element.xpath('.//a[text(... 阅读全文
posted @ 2019-02-21 00:02 随性岁分享 阅读(355) 评论(0) 推荐(0) 编辑
摘要: User-agent: Baiduspider Allow: /article Allow: /oshtml Allow: /ershou Allow: /$ Disallow: /product/ Disallow: / User-Agent: Googlebot Allow: /article 阅读全文
posted @ 2019-02-21 00:00 随性岁分享 阅读(170) 评论(0) 推荐(0) 编辑
摘要: import random def get_ua(): first_num = random.randint(55, 62) third_num = random.randint(0, 3200) fourth_num = random.randint(0, 140) os_type = [ '(W 阅读全文
posted @ 2019-02-20 23:59 随性岁分享 阅读(150) 评论(0) 推荐(0) 编辑
摘要: # Create your views here. from django.views import View # http://127.0.0.1:8000/books/ from rest_framework.authentication import SessionAuthentication 阅读全文
posted @ 2019-02-20 23:58 随性岁分享 阅读(126) 评论(0) 推荐(0) 编辑
摘要: BooleanField -> BooleanField() NullBooleanField -> NullBooleanField() CharField -> CharField(max_length=None, min_length=None, allow_blank=False, trim 阅读全文
posted @ 2019-02-20 23:57 随性岁分享 阅读(249) 评论(0) 推荐(0) 编辑
摘要: # 基本查询 print(BookInfo.objects.all()) print(BookInfo.objects.get(btitle='雪山飞狐').id) print(BookInfo.objects.get(id=3)) print(BookInfo.objects.get(pk=3)) 阅读全文
posted @ 2019-02-20 23:56 随性岁分享 阅读(445) 评论(0) 推荐(1) 编辑
摘要: 在form表单中设置csrf <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> 阅读全文
posted @ 2019-01-07 20:58 随性岁分享 阅读(243) 评论(0) 推荐(0) 编辑
摘要: flask框架 用Python做Web开发的三大框架特点 Django 主要特点是大而全,集成了很多的组件,例如:Admin Form Model等,不管你用不用的到,他都会为 你提供,通常用于大型Web应用,由于内部组件足够强大,所以使用Django可以做到一气呵成, Django的优点是大而全, 阅读全文
posted @ 2019-01-01 18:20 随性岁分享 阅读(866) 评论(0) 推荐(2) 编辑
摘要: json 是一种数据格式,以字典的形式展现出来,但是其中必须是双引号 数据格式 数据的一种组装形式 同源 同协议 同域名 同端口 $.ajax() 中同时封装了ajax(不跨域)和jsonp(跨域)请求数据的方式,默认传递数据json格式的 ajax # 必须在入口函数中执行 ... 阅读全文
posted @ 2018-12-27 16:21 随性岁分享 阅读(119) 评论(0) 推荐(0) 编辑
摘要: jQuery 概述 是js的一种函数库有美国人 John Resig编写 特点 写的少,做的多,国内用的jq1.0版本,可以兼容低版本的浏览器,支持链式编程或链式调用和隐式迭代 链式编程 $(this).siblings().slideDown() $(this).sib... 阅读全文
posted @ 2018-12-27 16:18 随性岁分享 阅读(207) 评论(0) 推荐(0) 编辑