使用scrapyd部署scrapy爬虫
Python抓取中文网页乱码问题
.text与.content的区别
requests的官方文档有这么一段:
We can read the content of the server’s response. Consider the GitHub timeline again: >>> import requests >>> r = requests.get(‘https://api.github.com/events') >>> r.text u’[{“repository”:{“open_issues”:0,”url”:”https://github.com/... Requests will automatically decode content from the server. Most unicode charsets are seamlessly decoded. When you make a request, Requests makes educated guesses about the encoding of the response based on the HTTP headers. The text encoding guessed by Requests is used when you access r.text. You can find out what encoding Requests is using, and change it, using the r.encoding property: >>> r.encoding ‘utf-8’ >>> r.encoding = ‘ISO-8859-1’ If you change the encoding, Requests will use the new value of r.encoding whenever you call r.text. You might want to do this in any situation where you can apply special logic to work out what the encoding of the content will be. For example, HTTP and XML have the ability to specify their encoding in their body. In situations like this, you should use r.content to find the encoding, and then set r.encoding. This will let you use r.text with the correct encoding. Requests will also use custom encodings in the event that you need them. If you have created your own encoding and registered it with the codecs module, you can simply use the codec name as the value of r.encoding and Requests will handle the decoding for you.
使用 Supervisor 管理进程
使用Docker安装Discourse
Discourse 是 Stack Overflow 的联合创始人 Jeff Atwood 推出的一个新的开源论坛项目,其目的是为了改变十年未变的论坛软件。它摒弃了传统论坛的话题讨论形式、拥有自学习系统、全Web应用同时适用于桌面和移动终端。
查看Docker容器日志
查看Docker容器日志
MySQL5.7忘记root密码解决方法
MySQL5.7忘记root密码解决方法
Centos系统安装Docker
Centos系统安装Docker
ansible使用笔记
ansible 是一个模型驱动的配置管理器,支持多节点发布、远程任务执行。默认使用 SSH 进行远程连接。无需在被管理节点上安装附加软件,可使用各种编程语言进行扩展。
ansible 基于Python语言实现,由Paramiko和PyYAML两个关键模块构建,特点有:
- 部署简单,只要主控端部署ansible环境,被控端无需任何操作
- 默认使用SSH协议对设备进行管理
- 主从集中化管理
- 配置简单,功能强大扩展性强
- 支持API及自定义模块,可通过Python轻松扩展
- 通过playbook定制强大配置、状态管理
ubuntu14.04 安装dokuwiki
DokuWiki是一个开源wiki引擎程序,运行于PHP环境下。Doku Wiki 程序小巧而功能强大、灵活,适合中小团队和个人网站知识库的管理。 DokuWiki可以与多种CMS程序进行整合,例如WordPress、XOOPS、PostNuke等。由于这个原因,很多Blog作者对DokuWiki比较感兴趣。
安装完django后的一些问题
安装完django后的一些问题记录