2018年5月15日

小练习-接口发布文章 验证未登录

摘要: import flask,time,jsonfrom lib import toolsserver = flask.Flask(__name__)@server.route('/login',methods=['get'])def login(): username = flask.request. 阅读全文

posted @ 2018-05-15 16:24 公子兔 阅读(123) 评论(0) 推荐(0) 编辑

try异常处理

摘要: #异常处理 兼容性更好 更健壮 first = input('请输入除数:')second = input('请输入被除数:')try: first = int(first) second = int(second) res = first/second li = [1,2,3,4]# except 阅读全文

posted @ 2018-05-15 16:23 公子兔 阅读(136) 评论(0) 推荐(0) 编辑

requests模块

摘要: import requests,random#发get请求# url='http://api.nnzhp.cn/api/user/stu_info'# data={'stu_name':'小黑'}#请求数据# req=requests.get(url,params=data)#发get请求# pri 阅读全文

posted @ 2018-05-15 16:23 公子兔 阅读(116) 评论(0) 推荐(0) 编辑

内置函数

摘要: #zip就是把两个list 合并到一起,把一维数组变成二维数组,如果同时循环2个list的时候# l1=['a','b','c','e','f','g']# l2=[1,2,3]# l3=['A','B']# l4=['z','z','k']# print(list(zip(l1,l2)))# fo 阅读全文

posted @ 2018-05-15 16:21 公子兔 阅读(146) 评论(0) 推荐(0) 编辑

接口-用户登录,返回session

摘要: # 2、参照接口文档上 # http://doc.nnzhp.cn/index.php?s=/6&page_id=12 登录接口 # 登录成功之后,返回seesionid,用户登录时间 # sessionid # 用户名+当前的时间戳 md5,seesion失效时间是60分钟 # sessionid 阅读全文

posted @ 2018-05-15 16:18 公子兔 阅读(2591) 评论(0) 推荐(0) 编辑

导航