摘要: 介绍 Scrapy是一个基于Twisted的异步处理框架, 是纯Python实现的爬虫框架, 其架构清晰, 模块之间的耦合程度低, 可扩展性极强, 可以灵活完成各种需求. 我们只需要定制开发几个模块就可以轻松实现一个爬虫. Scrapy依赖twisted 安装 linux下, 目录结构 Scrapy 阅读全文
posted @ 2019-04-24 19:06 孙昌恒 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 1. filter(func, lterable) 函数作用于序列, 返回True保留该元素 2. map(func, lterable) 将传入的函数依次作用到序列的每个元素, 并返回新的列表(惰性序列) 3. reduce(func, lterable) 函数必须接收两个参数, redure把结果继续和序列下一元素... 阅读全文
posted @ 2019-04-24 18:26 孙昌恒 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 基础命令 循环 阅读全文
posted @ 2019-04-24 18:25 孙昌恒 阅读(663) 评论(0) 推荐(0) 编辑
摘要: from bs4 import BeautifulSoup html_doc = """ The Dormouse's story asdf The Dormouse's story总共 f Once upon a time there were three little sisters; and their names were ... 阅读全文
posted @ 2019-04-24 18:23 孙昌恒 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 方法 参数 响应 阅读全文
posted @ 2019-04-24 18:22 孙昌恒 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 爬虫的三个步骤: 1 下载源码 2 解析源码 3 保存数据 请求头: user-agent referer host cookie 特殊请起头 (查看上一次请求获取特殊请求头的值。) 请求体: - 原始数据 - 原始数据 + token - 密文 - 找算法 - 直接使用密文 阅读全文
posted @ 2019-04-24 18:16 孙昌恒 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1 使用one2many, 另一张表必须要有一个many2one的字段, 反向关联只是为了方便取值 2 many2many会新增一个表 3 传统继承支持多重继承, 用列表表示: inhert = ['mail.thread', 'resource.mixin'] 4 进入odoo shell (用i 阅读全文
posted @ 2019-04-24 18:12 孙昌恒 阅读(1666) 评论(0) 推荐(0) 编辑
摘要: 参考: https://hub.packtpub.com/handle-odoo-application-data-with-orm-api-tutorial/ 一、特殊装饰器 二、特殊方法 查 增改删 在某些情况下, 我们需要扩展这些方法以添加一些业务逻辑, 以便在执行这些操作时触发 Python 阅读全文
posted @ 2019-04-24 18:11 孙昌恒 阅读(176) 评论(0) 推荐(0) 编辑