随笔分类 -  python

摘要:写法一: 1 paths=['D:\lser\local file1.txt(abcd)file2.txt(wxsd)file3.txt(qqw)','E:\path\jdk file2.txt(abcd)file5.txt(vv)','C:\duafile\dublock\dufell file4 阅读全文
posted @ 2025-03-01 13:19 hushuer 编辑
摘要:一、线程、进程的区别 https://www.zhihu.com/question/25532384 二、实际使用场景 登录3个用户,然后用这3个用户的session,进行10个进程,或者10个线程的操作(因为登录后没有退出登录,也没有被其他地方登录挤掉账号,所以session在一段时间内有效。且当 阅读全文
posted @ 2024-11-14 17:32 hushuer 编辑
摘要:【参考】 方法一参考链接如下,直接获取返回的cookie失败,拿到的cookies是空。(因为登录的url返回用f12看着是空的,用Charles才能看到,进行了重定向,返回了重定向的url) https://baijiahao.baidu.com/s?id=1781328761925882355& 阅读全文
posted @ 2024-08-29 17:57 hushuer 编辑
摘要:【场景】 测试使用图片验证码登录 接口返回的是图片的base64编码,我们需要 1、将base64编码转为图片 2、去识别图片中的验证码,然后再拿验证码去做后续的图片验证码登录测试 【参考链接】 https://blog.51cto.com/u_16213316/10678659 https://w 阅读全文
posted @ 2024-07-26 17:42 hushuer 编辑
摘要:1、从sql读取需要的内容,作为接口的请求参数的一部分,生成请求的body,再去请求接口 1 import requests 2 import pymysql 3 import json 4 5 6 conn = pymysql.connect(host="172.16.11.118", port= 阅读全文
posted @ 2024-07-17 14:29 hushuer 编辑
摘要:参考: https://www.php.cn/faq/630018.html https://blog.csdn.net/weixin_42575020/article/details/128850513?utm_medium=distribute.pc_relevant.none-task-blo 阅读全文
posted @ 2024-01-12 16:01 hushuer 编辑
摘要:一、网上的参考 https://www.begtut.com/python/ref-requests-delete.html 二、我的写法 接口长这样 参数是以json传入: a={'id':'xxxxxxxxxxxx','xx':'xxxxxxxx','xx':'xxxxxxxx','xx':'x 阅读全文
posted @ 2023-05-09 17:18 hushuer 编辑
摘要:https://blog.csdn.net/qq_41985134/article/details/122956104 阅读全文
posted @ 2023-03-30 15:05 hushuer 编辑
摘要:需求:希望一段时间内,每一天都生成随机的开始时间和结束时间 问题: 使用pandas生成了每一天,然后没有想到怎么用随机的时间去做加减 解决:生成随机的时分秒之后,转为str,再和pandas生成的每一天的str拼接起来 阅读全文
posted @ 2023-03-30 11:50 hushuer 编辑
摘要:strftime: 将给定格式的日期时间对象转换为字符串。日期时间对象=>字符串,控制输出格式 strptime:将字符串解析为给定格式的日期时间对象。字符串=>日期时间对象,解析字符串 一般进行接口请求时,或者将数据写入数据库时,传入的时间参数均为字符串格式,所以需要strftime。 如果是使用 阅读全文
posted @ 2023-01-03 11:59 hushuer 编辑
摘要:1、json.dumps(),json.loads() json.dumps() 将python对象(dict)编码成Json字符串(str) json.loads() 将Json字符串(str)解码成python对象(dict) 一般构造接口数据本身时,该数据本身为dict格式,需要使用json. 阅读全文
posted @ 2023-01-03 11:20 hushuer 编辑
摘要:参考: https://www.cnblogs.com/liangmingshen/p/8909376.html 1.random.random() #用于生成一个0到1的 随机浮点数:0<= n < 1.0 1 import random 2 a = random.random() 3 print 阅读全文
posted @ 2022-12-28 10:40 hushuer 编辑
摘要:(1)创建mqtt连接 参考https://www.jianshu.com/p/06d23de47aed 文中写的发布消息代码如下: 文件名:mypub.py #!/usr/bin/env python #coding:utf-8 import time import json import psu 阅读全文
posted @ 2022-12-27 15:44 hushuer 编辑
摘要:原文链接:https://blog.csdn.net/chenhepg/article/details/118766300 ————————————————用于生成一个固定频率的DatetimeIndex时间索引。 使用场景很多,一般加测试数据的时候,都需要用到数据对应的时间字段。 1 方法及参数介 阅读全文
posted @ 2022-12-27 11:55 hushuer 编辑
摘要:1、需要插入多条数据,一天一条,time的格式为yyyy-mm-dd 00:00:00 使用pandas插件包, 取某一段时间的日粒度, 然后进行日期格式化,使用strftime 2、每条开头有唯一性表示的id,uuid,观察其格式为大写,且没有短横线,所以写法为id=uuid.uuid1().he 阅读全文
posted @ 2022-12-27 10:34 hushuer 编辑
摘要:本来一开始使用的time.sleep(5),但是执行时间长了之后,会与实际时间有偏差,因为没有计算程序本身运行的时间。 解决: 使用blockingScheduler 将send()这个方法,每5s执行一次: 阅读全文
posted @ 2022-11-23 16:46 hushuer 编辑
摘要:理解: 始终拿0位置的值,依次与后面位置的进行比较; 比较时,谁小,谁就放在0位置 阅读全文
posted @ 2022-11-07 12:03 hushuer 编辑
摘要:备注的地方都是需要注意的地方 2、当sql最后一个为内容为单引号时,需要使用f+3个双引号把内容括起来 阅读全文
posted @ 2022-11-07 11:10 hushuer 编辑
摘要:1、首先在pyCharm中install (我的做法) 或者: pip install C:\TDengine\connector\python\windows\python3(参考 https://blog.csdn.net/Tomonkey/article/details/108807914,实 阅读全文
posted @ 2022-10-10 16:47 hushuer 编辑
摘要:参考:https://www.cnblogs.com/alexgl2008/articles/12703793.html 1、连接后查询数据: 2、连接后插入数据: 执行结果: 1 import jaydebeapi 2 import random 3 import pandas as pd 4 f 阅读全文
posted @ 2022-10-10 15:59 hushuer 编辑

点击右上角即可分享
微信分享提示