随笔分类 -  python

摘要:1、远程python环境准备 下载miniconda https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/ 注意py版本,需要下载对应版本的conda,找到对应的版本后(这里选择py312),鼠标右键复制链接 wget 相关链接 bash 阅读全文
posted @ 2024-03-05 13:57 xunhanliu 阅读(84) 评论(0) 推荐(0) 编辑
摘要:虽然我的工程语言是python语言,在工程搭建过程中非常注意类型提示的问题。 关于方法的方法的返回值类型的问题: 常用的方式是在函数/方法书写一些尖头+类型,这样调用方能很方便的对return值进行方法的提示。这也是最常用的的一种方式。有时候对于第三方库的方法的返回值,无法类型提示的话,我们可以简单 阅读全文
posted @ 2023-03-26 22:48 xunhanliu 阅读(26) 评论(0) 推荐(0) 编辑
摘要:一、需求:以最小的侵入的方式,对fastapi 中的接口进行日志记录(主要描述接口是干什么的,最终结果是不是完成了) 1、现状: import time @app.middleware("http") async def add_process_time_header(request: Reques 阅读全文
posted @ 2022-02-25 17:01 xunhanliu 阅读(3307) 评论(0) 推荐(0) 编辑
摘要:测试版本: mysql:5.7 ; es:5.6.4 ; elasticsearch-head:5 ; kibana:5.6.4 ; go-mysql-elasticsearch(mysql 数据自动同步到es的工具) 重要的事情说三遍: es 的东西,版本一点都不能差。 es 的东西,版本一点都不 阅读全文
posted @ 2021-12-31 12:14 xunhanliu 阅读(236) 评论(1) 推荐(0) 编辑
摘要:测试版本: Python 3.7.6 1、时间戳的值有最大值限制:大概是32000000000 测试代码: import time,datetime time.localtime(33000000000) datetime.datetime.fromtimestamp(33000000000) 2、 阅读全文
posted @ 2021-12-29 11:07 xunhanliu 阅读(22) 评论(0) 推荐(0) 编辑
摘要:1、检查一下当前工程中,指定文件夹下,是不是有一个文件夹A与和文件B同名。 可能是你想引用文件B 的内容,不小心,又新建了一个同名空文件夹A 参见:https://blog.csdn.net/LMFranK/article/details/101161431 阅读全文
posted @ 2021-12-15 10:39 xunhanliu 阅读(723) 评论(0) 推荐(0) 编辑
摘要:1、定制文档生成: 参见 fastapi/applycations.py 中的setup. /docs 把所有的路径routes 都包含进去了。参考实现根据tag 实现文档生成。 要先生成docs 需要的openapi_url。(其中get_openapi 是fastapi.openapi.util 阅读全文
posted @ 2021-06-29 16:31 xunhanliu 阅读(245) 评论(0) 推荐(0) 编辑
摘要:指令 含义 示例 注释 %a 当地工作日的缩写。 Sun, Mon, …, Sat (美国); So, Mo, …, Sa (德国) (1) %A 当地工作日的全名。 Sunday, Monday, …, Saturday (美国); Sonntag, Montag, …, Samstag (德国) 阅读全文
posted @ 2020-11-19 15:38 xunhanliu 阅读(689) 评论(0) 推荐(0) 编辑
摘要:1、参考:Twitter Standard API rate limits 推特标准接口API的请求频率限制说明 2、api 限制参数的说明: 请求rate_limit_status,下面是返回的部分数据: 以/users/为例: limit : 此接口在下次刷新(15min 一次)前的总可用调用次 阅读全文
posted @ 2020-11-18 11:29 xunhanliu 阅读(465) 评论(0) 推荐(0) 编辑
摘要:基本测试脚本(python): import time,requests def test_ip_freq(freq): if freq==0: return #测试1分钟 delay=1/freq t0=time.time() requests_num=0 status="success" whi 阅读全文
posted @ 2020-07-27 12:12 xunhanliu 阅读(1551) 评论(0) 推荐(0) 编辑
摘要:问题情景: scrapy爬取网页,返回值418(按照请求来说,是一个完整的网络请求)。说明此接口已经被后台爬虫检测程序检测到了。 通过研读scrapy文档,在自定义的418检测下载中间件里面,process_response中检测返回值,并设置request的http/https代理,然后retur 阅读全文
posted @ 2020-07-08 18:42 xunhanliu 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-02-21 19:57 xunhanliu 阅读(289) 评论(0) 推荐(1) 编辑
摘要:Python 3.5.6 1、js风格的回调测试 结果:符合预期 阅读全文
posted @ 2019-06-08 12:20 xunhanliu 阅读(167) 评论(0) 推荐(0) 编辑
摘要:位操作符 ASCII码与字符相互转换 字符转ascii码: ascii码转字符: 阅读全文
posted @ 2019-05-21 19:06 xunhanliu 阅读(514) 评论(0) 推荐(0) 编辑
摘要:#基于python3 Matplotlib构建的3D图形: 使用pycharm的小伙伴把sciview给关掉: 因为sciview显示的是png图片。3d图形一般我们都需要拖拖拽拽的。 参见: https://blog.csdn.net/xguardian/article/details/81088 阅读全文
posted @ 2019-05-05 13:45 xunhanliu 阅读(428) 评论(0) 推荐(0) 编辑
摘要:参考: https://blog.csdn.net/jenyzhang/article/details/52047557 https://blog.csdn.net/liangzuojiayi/article/details/78187704 需求: 封装一个带分组功能的bar绘制函数 绘制效果: 阅读全文
posted @ 2019-03-28 13:02 xunhanliu 阅读(376) 评论(0) 推荐(0) 编辑

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