自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 mongo4.0.0 加用户认证

一. 数据库版本 mongo 4.0.0 二. 为mongo添加用户认证 1. 创建超级用户 mongo #这里注意版本(确认验证时候使用mongo与现在所加用户的mongo是同一个) MongoDB shell version: 4.0.0 db.createUser({user:“root”,pwd:“root”,roles:[{role:“userAdminAnyDatabase”...

2018-10-09 19:04:51 1270

原创 motor和pymongo的auth连接

#motor import motor import sys,os print(os.path.join(os.path.abspath('config'))) from . import config as cfg # mongodb://user:pass@localhost:27017/database_name uri='mongodb://{0}:{1}@{2}:{3}/{4}'.f...

2018-10-09 18:25:03 896

原创 async def 函数 的调用

import asyncio async def add(x,y): r = x+y return r async def bad_call(a,b,c,d): a_b = await add(a,b) await asyncio.sleep(1) c_d = await add(c,d) print (a_b*c_d) if __name__ ...

2018-09-30 14:20:46 14298 1

原创 tornado构造中转接口,带自己的cookie信息,并发送json数据

#这里的self是tornado.web.RequestHandler async def toSave(self,text,content): http_client = tornado.httpclient.AsyncHTTPClient() log.debug('调用case_analysis接口') host = self.request...

2018-09-30 11:27:02 326

原创 Python 笔试协程

输入a,b,c,d四个整数,打印(a+b)*(c+d)的值。假设a+b的过程是耗时1秒IO操作 import asyncio async def add(x,y): r = x+y return r async def bad_call(a,b,c,d): a_b = await add(a,b) await asyncio.sleep(1) c_d ...

2018-09-21 16:54:32 175

原创 tornado + motor 异步使用

tornado + motor 异步使用 1.python 环境以及版本 python 3.5 motor 2.0.0 tornado 5.1 2.motor简单介绍 MongoDB 的异步python驱动 官网介绍依赖如下: ​ (1) Unix, including Mac OS X. Windows is not supported. ​ (2) ...

2018-09-16 21:40:49 1960

原创 flask探索-1

安装 pip install -U Flask Successfully built itsdangerous MarkupSafe Installing collected packages: MarkupSafe, Jinja2, itsdangerous, Werkzeug, click, Flask Successfully installed Flask-1.0.2 Jinja2-...

2018-08-29 23:37:44 89

原创 快速排序 Python

整体思路是分治法 1.pythonic风格 #pythonic风格 def quicksort1(arr): if len(arr)<=1: return arr key = arr[-1] lesser = [i for i in arr[:-1] if i<key] greater = [i for i in arr[:-1] ...

2018-08-21 20:31:35 113

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除