摘要: from .conf import HOST, PORT, POOL_NAME import redis redis_pool = redis.ConnectionPool(host=HOST, port=PORT, max_connections=20) class RedisOperator(object): """Redis 操作类""" def __init_... 阅读全文
posted @ 2018-01-18 21:15 安迪9468 阅读(625) 评论(0) 推荐(0) 编辑
摘要: python中实现mysql连接池 阅读全文
posted @ 2018-01-18 20:55 安迪9468 阅读(5011) 评论(0) 推荐(0) 编辑
摘要: flask简单的路由分发 访问方法 阅读全文
posted @ 2018-01-18 17:30 安迪9468 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 进程少时,手动单个创建进程; 进程多时,用进程池创建进程。 用进程池创建子进程 from multiprocessing import Pool import os, time, random def worker(msg): t_start = time.time() print("%s开始执行, 阅读全文
posted @ 2018-01-18 10:34 安迪9468 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 用类创建子进程 输出结果: 阅读全文
posted @ 2018-01-18 10:08 安迪9468 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 多线程 运行结果 Process语法结构如下: Process([group [, target [, name [, args [, kwargs]]]]]) target:表示这个进程实例所调用对象; args:表示调用对象的位置参数元组; kwargs:表示调用对象的关键字参数字典; name 阅读全文
posted @ 2018-01-18 09:55 安迪9468 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 此工具用于抓取302等看不到的包。 设置: 步骤一 步骤二 重启fiddler软件,设置才有效。 设置谷歌浏览器,使浏览器的访问都经过fiddler。(fiddler就成了代理了)设置如下 隐藏图片的抓取过程 阅读全文
posted @ 2018-01-18 01:26 安迪9468 阅读(170) 评论(0) 推荐(0) 编辑
摘要: #coding:utf-8 import requests # url = 'http://www.baidu.com' # response = requests.get(url) # print (response.cookies) # print (type(response.cookies)) # 将cookjar转换成字典格式的cookies # dict_cookies = ... 阅读全文
posted @ 2018-01-18 00:29 安迪9468 阅读(116) 评论(0) 推荐(0) 编辑
摘要: (一)如何带cookies请求 方法一:headers中带cookies 方法二:get方法参数中带cookies (二)session的状态保持。 有了session后,第二次请求是,就不用再传cookies、headers了。 阅读全文
posted @ 2018-01-18 00:22 安迪9468 阅读(681) 评论(0) 推荐(0) 编辑