上一页 1 ··· 4 5 6 7 8 9 10 11 下一页
摘要: 1.cors全称跨域资源共享. 2.跨域是指,浏览器对于js的同源策略限制. 跨域包含如下内容: 1.域名不同 2.端口不同 3.二级域名不同 4.协议不同(http协议和https协议是不同的) 3.解决跨域问题, cors # cors对请求做了分类,分为简单请求和特殊请求.​1.简单请求 1) 阅读全文
posted @ 2023-10-13 14:07 CJTARRR 阅读(54) 评论(0) 推荐(0)
摘要: 需要修改两部分,一是swagger文档,二是内置的参数校验失败处理函数。 1.移除swagger中的422响应描述 from fastapi import FastAPI from fastapi.openapi.utils import get_openapi def openapi_patch_ 阅读全文
posted @ 2023-10-13 09:20 CJTARRR 阅读(163) 评论(0) 推荐(0)
摘要: from multiprocessing import cpu_countcpu_core_num: int = cpu_count()print(f'本机cpu核心数为:{cpu_core_num}')# 此计算方式计算的是cpu的线程数,如8核心16线程的cpu,将计算得出16。同时,这种计算方 阅读全文
posted @ 2023-10-12 17:38 CJTARRR 阅读(155) 评论(0) 推荐(0)
摘要: 中间件先注册,靠近服务端,后注册,则靠近客户端。 请求从客户端发出,先执行后注册的中间件,通过call_next获得后续所有中间件和路由方法的结果。 响应从服务端发出,则先经过先注册的中间件,通过return给到下一个中间件。 如果没有调用call_next,直接返回响应,则后续的中间件和路由方法都 阅读全文
posted @ 2023-10-12 14:57 CJTARRR 阅读(393) 评论(0) 推荐(0)
摘要: fastapi手动添加swagger文档描述 """在正常开发过程中,fastapi会自动地将正确响应(status=200)和输入校验失败响应(status=422)添加到文档中.当有自定义的响应描述添加到文档中时,就需要我们手动添加到路径函数的:responses参数中.用户可以按照openap 阅读全文
posted @ 2023-10-11 23:37 CJTARRR 阅读(948) 评论(0) 推荐(0)
摘要: 由于fastapi默认使用国外的cdn获得支持swagger文档的js和css文件, 所以在国内, /docs接口渲染不出来. 解决方法1 # 在app生效之前,将生成swagger文档的方法替换掉.(在fastapi为:fastapi.openapi.docs.get_swagger_ui_htm 阅读全文
posted @ 2023-10-11 09:42 CJTARRR 阅读(1125) 评论(0) 推荐(0)
摘要: 示例 uri = 'mongodb://{username}:{password}@{host}:{port}/{dbname}' 特殊情况 username和password含有"@"和":"时,将"@"和":"进行url编码.​@ ==> %40: ==> %3a 阅读全文
posted @ 2023-10-10 15:06 CJTARRR 阅读(72) 评论(0) 推荐(0)
摘要: { 'scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware': 100, 'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware': 300, 'scrapy.download 阅读全文
posted @ 2023-10-10 09:39 CJTARRR 阅读(11) 评论(0) 推荐(0)
摘要: windows修改服务的启动命令 # 修改服务的"可执行文件路径"win+r ==> regedit ==> HKEY_LOCAL_MACHINE ==> SYSTEM ==> CurrentControlSet ==> service ==>服务名称(比如Mongo) ==> imagepath 阅读全文
posted @ 2023-10-07 08:28 CJTARRR 阅读(354) 评论(0) 推荐(0)
摘要: python进程之间共享数据 Value # Value是multiprocessing库提供的对象类​# 示例:from multiprocessing import Process, Value​​def task(num: Value): # 提供锁解决同步问题 with num.get_lo 阅读全文
posted @ 2023-10-06 23:34 CJTARRR 阅读(318) 评论(0) 推荐(0)
摘要: fork模式 1.仅unix系统支持,并且是unix系统的默认模式.2.使用该模式创建子进程的时候,会复制父进程的全部变量,支持传参(任意类型)给子进程,但是不会复制父进程的线程.3.该模式相当于将父进程的内存复制一份用于创建子进程.但是由于不复制线程的特点,当父进程存在多线程的时候,可能会带来安全 阅读全文
posted @ 2023-10-04 19:07 CJTARRR 阅读(530) 评论(0) 推荐(0)
摘要: https://tls.browserleaks.com/json 阅读全文
posted @ 2023-09-28 10:38 CJTARRR 阅读(992) 评论(0) 推荐(0)
摘要: 介绍 http请求头的Range参数是指定请求目标资源字节偏移量范围的参数。 返回状态码是204。 当请求资源文件的时候, 可以通过该参数指定获取资源的字节偏移量范围。 这个字节偏移量范围是从0开始的左右闭合区间。 举例 Range:bytes=500-999 # 表示获取资源文件偏移量为500到9 阅读全文
posted @ 2023-09-14 09:27 CJTARRR 阅读(1037) 评论(0) 推荐(0)
摘要: from pymongo import MongoClient​# 连接到 MongoDB 实例client = MongoClient('mongodb://localhost:27017/')​# 获取数据库db = client['testdb']​# 启动一个会话with client.st 阅读全文
posted @ 2023-09-09 15:36 CJTARRR 阅读(178) 评论(0) 推荐(0)
摘要: 在python中使用正则表达式时,小括号"()"有分组的意思,而在正则表达式中,小括号有把几个被括起来的几个符号作为一个子表达式的含义.所以,当在python中使用正则表达式的时候,正则表达式里面的括号就会既有分组功能,又有构成子表达式的功能.在使用re.findall()方法时,这种情况就会匹配出 阅读全文
posted @ 2023-08-30 17:26 CJTARRR 阅读(140) 评论(0) 推荐(1)
摘要: 安装 pip install curl_cffi 使用 from curl_cffi import requests​# impersonate参数指定了模拟浏览器的型号res = requests.get("https://tls.browserleaks.com/json", impersona 阅读全文
posted @ 2023-08-08 16:00 CJTARRR 阅读(901) 评论(0) 推荐(0)
摘要: 大佬开发的工具,可以很方便地对app抓包。 项目地址: https://github.com/r0ysue/r0capture 阅读全文
posted @ 2023-08-08 13:43 CJTARRR 阅读(151) 评论(0) 推荐(0)
摘要: import frida,sys​def on_message(message,data): if message['type'] == 'send': print("[*] {0}".format(message['payload'])) else: print(message)​​jscode 阅读全文
posted @ 2023-08-08 11:53 CJTARRR 阅读(401) 评论(0) 推荐(0)
摘要: 在子线程内直接获取事件循环会报错:RuntimeError: There is no current event loop in thread 'Thread-2',此时的代码为: loop = asyncio.get_event_loop()loop.run_until_complete(协程函数 阅读全文
posted @ 2023-08-03 17:52 CJTARRR 阅读(500) 评论(0) 推荐(0)
摘要: 安装 pip install r-useragent 使用 from random_useragent import UserAgent​u = UserAgent()​# generate android user-agentprint(u.android()) # randomprint(u.a 阅读全文
posted @ 2023-08-03 17:43 CJTARRR 阅读(509) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页