2019年6月1日

itsdangerous 产生token

摘要: import itsdangerous #产生token def create_token(data,expires_time=3600): salt = '!@#' t = itsdangerous.TimedJSONWebSignatureSerializer(salt,expires_in=expires_time) # 产生一个token res = t... 阅读全文

posted @ 2019-06-01 13:51 dongxl 阅读(159) 评论(0) 推荐(0) 编辑

multiprocessing多进程

摘要: # 每个进程之间的数据是独立的 import multiprocessing, time # 进程 cpu密集型任务 ,多线程 io 密集型任务 def conversation(qq): print('开始聊天了,%s在聊' % qq) time.sleep(1) if __name__ == '__main__': for i in range(10)... 阅读全文

posted @ 2019-06-01 13:41 dongxl 阅读(101) 评论(0) 推荐(0) 编辑

多线程下载图片

摘要: import requests,threading,time from hashlib import md5 urls = [ 'http://www.178linux.com/wp-content/uploads/2018/02/5.jpg', 'http://img1.imgtn.bdimg.com/it/u=1139158180,2224775217&fm=11&gp=0... 阅读全文

posted @ 2019-06-01 13:39 dongxl 阅读(93) 评论(0) 推荐(0) 编辑

线程池

摘要: import threadpool import requests from hashlib import md5 urls = [ 'http://www.178linux.com/wp-content/uploads/2018/02/5.jpg', 'http://img1.imgtn.bdimg.com/it/u=1139158180,2224775217&fm=11... 阅读全文

posted @ 2019-06-01 13:36 dongxl 阅读(64) 评论(0) 推荐(0) 编辑

导航