网站的控制面板苏州淘宝运营培训

bicheng/2026/1/24 19:55:56/文章来源:
网站的控制面板,苏州淘宝运营培训,抖音代运营法律案件,长沙网站关键词排名推广公司1.简介 对象存储服务(Object Storage Service ,OSS) 是一种 海量、安全、低成本、高可靠的云存储服务#xff0c;适合存放任意类型的文件。容量和处理能力弹性扩展#xff0c;多种存储类型供选择#xff0c;全面优化存储成本。 2.如何使用。参考文档 看文档#xff0c;说的…1.简介 对象存储服务(Object Storage Service ,OSS) 是一种 海量、安全、低成本、高可靠的云存储服务适合存放任意类型的文件。容量和处理能力弹性扩展多种存储类型供选择全面优化存储成本。 2.如何使用。参考文档 看文档说的很明白这里就不演示了 3. SpringCloudAlibaba-OSS spring-cloud-alibaba/README-zh.md at 2022.x · alibaba/spring-cloud-alibaba · GitHub 好像新版本没有starter了 自己封装一下原生API吧 package com.jmj.gulimall.product.config;import com.aliyun.oss.ClientBuilderConfiguration; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.common.auth.CredentialsProvider; import com.aliyun.oss.common.auth.DefaultCredentialProvider; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;Configuration public class OssClientConfiguration {Value(${spring.cloud.alicloud.access-key})private String accessKey;Value(${spring.cloud.alicloud.secret-key})private String secretKey;Value(${spring.cloud.alicloud.endpoint})private String endpoint;Beanpublic OSS ossClient() {// 创建OSSClient实例。CredentialsProvider credentialsProvider new DefaultCredentialProvider(accessKey, secretKey);// 创建ClientBuilderConfiguration。// ClientBuilderConfiguration是OSSClient的配置类可配置代理、连接超时、最大连接数等参数。ClientBuilderConfiguration conf new ClientBuilderConfiguration();// 设置Socket层传输数据的超时时间默认为50000毫秒。conf.setSocketTimeout(10000);// 设置建立连接的超时时间默认为50000毫秒。conf.setConnectionTimeout(10000);// 设置失败请求重试次数默认为3次。conf.setMaxErrorRetry(5);OSS ossClient new OSSClientBuilder().build(endpoint, credentialsProvider,conf);return ossClient;}}package com.jmj.gulimall.product.ossclient;import com.aliyun.oss.ClientException; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSException; import com.aliyun.oss.model.ObjectMetadata; import com.aliyun.oss.model.PutObjectRequest; import com.aliyun.oss.model.PutObjectResult; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream;Component Slf4j public class OssClientTemplate {Autowiredprivate OSS ossClient;public Boolean uploadFile(String bucketName, String objectName, File file) {// 创建PutObjectRequest对象。try {PutObjectRequest putObjectRequest new PutObjectRequest(bucketName, objectName, file);// 如果需要上传时设置存储类型和访问权限请参考以下示例代码。ObjectMetadata metadata new ObjectMetadata();metadata.setHeader(x-oss-forbid-overwrite, true);// metadata.setObjectAcl(CannedAccessControlList.Private);putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result ossClient.putObject(putObjectRequest);log.info(上传成功文件名 {}, objectName);return true;} catch (OSSException oe) {log.error(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);log.error(Error Message: oe.getErrorMessage());log.error(Error Code: oe.getErrorCode());log.error(Request ID: oe.getRequestId());log.error(Host ID: oe.getHostId());} catch (ClientException ce) {log.error(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);log.error(Error Message: ce.getMessage());}return false;}public Boolean uploadFile(String bucketName, String objectName, String content){// 创建PutObjectRequest对象。ByteArrayInputStream byteArrayInputStream new ByteArrayInputStream(content.getBytes());try {PutObjectRequest putObjectRequest new PutObjectRequest(bucketName, objectName, byteArrayInputStream);// 如果需要上传时设置存储类型和访问权限请参考以下示例代码。ObjectMetadata metadata new ObjectMetadata();metadata.setHeader(x-oss-forbid-overwrite, true);// metadata.setObjectAcl(CannedAccessControlList.Private);putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result ossClient.putObject(putObjectRequest);log.info(上传成功文件名 {}, objectName);return true;} catch (OSSException oe) {log.error(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);log.error(Error Message: oe.getErrorMessage());log.error(Error Code: oe.getErrorCode());log.error(Request ID: oe.getRequestId());log.error(Host ID: oe.getHostId());} catch (ClientException ce) {log.error(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);log.error(Error Message: ce.getMessage());}finally {if (byteArrayInputStream!null){try {byteArrayInputStream.close();} catch (IOException e) {e.printStackTrace();}}}return false;}public Boolean uploadFile(String bucketName, String objectName, InputStream inputStream){// 创建PutObjectRequest对象。try {PutObjectRequest putObjectRequest new PutObjectRequest(bucketName, objectName, inputStream);// 如果需要上传时设置存储类型和访问权限请参考以下示例代码。ObjectMetadata metadata new ObjectMetadata();metadata.setHeader(x-oss-forbid-overwrite, true);// metadata.setObjectAcl(CannedAccessControlList.Private);putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result ossClient.putObject(putObjectRequest);log.info(上传成功文件名 {}, objectName);return true;} catch (OSSException oe) {log.error(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);log.error(Error Message: oe.getErrorMessage());log.error(Error Code: oe.getErrorCode());log.error(Request ID: oe.getRequestId());log.error(Host ID: oe.getHostId());} catch (ClientException ce) {log.error(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);log.error(Error Message: ce.getMessage());}finally {if (inputStream!null){try {//其实流已经被关闭了我再关闭一下保险一点inputStream.close();} catch (IOException e) {e.printStackTrace();}}}return false;}public Boolean uploadFile(String objectName, InputStream inputStream){// 创建PutObjectRequest对象。return uploadFile(gulimall-jmj, objectName, inputStream);} }4.后端签名直传 package com.jmj.gulimall.third.config;import com.aliyun.oss.ClientBuilderConfiguration; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.common.auth.CredentialsProvider; import com.aliyun.oss.common.auth.DefaultCredentialProvider; import com.jmj.gulimall.third.ossclient.OssClientTemplate; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;Configuration EnableConfigurationProperties({OssConfigurationProperties.class}) Slf4j RefreshScope //动态从配置中心获取配置 public class OssClientConfiguration {Autowiredprivate OssConfigurationProperties ossConfigurationProperties;Beanpublic OSS ossClient() {// 创建OSSClient实例。CredentialsProvider credentialsProvider new DefaultCredentialProvider(ossConfigurationProperties.getAccessKey(), ossConfigurationProperties.getSecretKey());// 创建ClientBuilderConfiguration。// ClientBuilderConfiguration是OSSClient的配置类可配置代理、连接超时、最大连接数等参数。ClientBuilderConfiguration conf new ClientBuilderConfiguration();// 设置是否支持CNAME。CNAME用于将自定义域名绑定到目标Bucket。conf.setSupportCname(true);// 设置Socket层传输数据的超时时间默认为50000毫秒。conf.setSocketTimeout(10000);// 设置建立连接的超时时间默认为50000毫秒。conf.setConnectionTimeout(10000);// 设置失败请求重试次数默认为3次。conf.setMaxErrorRetry(5);OSS ossClient new OSSClientBuilder().build(ossConfigurationProperties.getEndpoint(), credentialsProvider, conf);log.info(ossClient初始化完成,properties{},ossConfigurationProperties);return ossClient;}Beanpublic OssClientTemplate ossClientTemplate(OSS ossClient) {return new OssClientTemplate(ossClient,ossConfigurationProperties);}}package com.jmj.gulimall.third.config;import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.context.config.annotation.RefreshScope;ConfigurationProperties(prefix spring.cloud.alicloud) Data RefreshScope //动态从配置中心获取配置 public class OssConfigurationProperties {private String accessKey;private String secretKey;private String endpoint;private String regionEnd;private String bucket;}package com.jmj.gulimall.third.controller;import com.aliyun.oss.OSS; import com.aliyun.oss.common.utils.BinaryUtil; import com.aliyun.oss.model.MatchMode; import com.aliyun.oss.model.PolicyConditions; import com.jmj.gulimall.third.common.R; import com.jmj.gulimall.third.config.OssConfigurationProperties; import com.jmj.gulimall.third.ossclient.OssClientTemplate; import lombok.extern.slf4j.Slf4j; import org.codehaus.jettison.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map;RestController Slf4j RequestMapping(/oss) public class OssController {Autowiredprivate OssClientTemplate ossClientTemplate;Autowiredprivate OssConfigurationProperties properties;GetMapping(/policy)public R policy(HttpServletRequest request, HttpServletResponse response) {// 设置上传回调URL即回调服务器地址用于处理应用服务器与OSS之间的通信。OSS会在文件上传完成后把文件上传信息通过此回调URL发送给应用服务器。 // String callbackUrl https://192.168.0.0:8888;// 设置上传到OSS文件的前缀可置空此项。置空后文件将上传至Bucket的根目录下。SimpleDateFormat simpleDateFormat new SimpleDateFormat(yyyy-MM-dd);String formatDate simpleDateFormat.format(new Date());String dir formatDate /;OSS ossClient ossClientTemplate.getOssClient();String accessKeyId properties.getAccessKey();String regionEnd properties.getRegionEnd();String bucket properties.getBucket();String host https:// bucket . regionEnd;try {long expireTime 30;long expireEndTime System.currentTimeMillis() expireTime * 1000;Date expiration new Date(expireEndTime);// PostObject请求最大可支持的文件大小为5 GB即CONTENT_LENGTH_RANGE为5*1024*1024*1024。PolicyConditions policyConds new PolicyConditions();policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, 1048576000);policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, dir);String postPolicy ossClient.generatePostPolicy(expiration, policyConds);byte[] binaryData postPolicy.getBytes(utf-8);String accessId accessKeyId;String encodedPolicy BinaryUtil.toBase64String(binaryData);String postSignature ossClient.calculatePostSignature(postPolicy);MapString, String respMap new LinkedHashMapString, String();respMap.put(accessid, accessId);respMap.put(policy, encodedPolicy);respMap.put(signature, postSignature);respMap.put(dir, dir);respMap.put(host, host);respMap.put(expire, String.valueOf(expireEndTime / 1000));// respMap.put(expire, formatISO8601Date(expiration));return R.ok().put(data,respMap);} catch (Exception e) {// Assert.fail(e.getMessage());log.error(e.getMessage(), e);}return R.error(上传签名异常);}}package com.jmj.gulimall.third.ossclient;import com.aliyun.oss.ClientException; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSException; import com.aliyun.oss.model.ObjectMetadata; import com.aliyun.oss.model.PutObjectRequest; import com.aliyun.oss.model.PutObjectResult; import com.jmj.gulimall.third.config.OssConfigurationProperties; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream;Slf4j public class OssClientTemplate {private OSS ossClient;public OSS getOssClient() {return ossClient;}private OssConfigurationProperties properties;public OssClientTemplate(OSS ossClient, OssConfigurationProperties properties) {this.ossClient ossClient;this.properties properties;}public Boolean uploadFile(String bucketName, String objectName, File file) {// 创建PutObjectRequest对象。try {PutObjectRequest putObjectRequest new PutObjectRequest(bucketName, objectName, file);// 如果需要上传时设置存储类型和访问权限请参考以下示例代码。ObjectMetadata metadata new ObjectMetadata();metadata.setHeader(x-oss-forbid-overwrite, true);// metadata.setObjectAcl(CannedAccessControlList.Private);putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result ossClient.putObject(putObjectRequest);log.info(上传成功文件名 {}, objectName);return true;} catch (OSSException oe) {log.error(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);log.error(Error Message: oe.getErrorMessage());log.error(Error Code: oe.getErrorCode());log.error(Request ID: oe.getRequestId());log.error(Host ID: oe.getHostId());} catch (ClientException ce) {log.error(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);log.error(Error Message: ce.getMessage());}return false;}public Boolean uploadFile(String bucketName, String objectName, String content){// 创建PutObjectRequest对象。ByteArrayInputStream byteArrayInputStream new ByteArrayInputStream(content.getBytes());try {PutObjectRequest putObjectRequest new PutObjectRequest(bucketName, objectName, byteArrayInputStream);// 如果需要上传时设置存储类型和访问权限请参考以下示例代码。ObjectMetadata metadata new ObjectMetadata();metadata.setHeader(x-oss-forbid-overwrite, true);// metadata.setObjectAcl(CannedAccessControlList.Private);putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result ossClient.putObject(putObjectRequest);log.info(上传成功文件名 {}, objectName);return true;} catch (OSSException oe) {log.error(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);log.error(Error Message: oe.getErrorMessage());log.error(Error Code: oe.getErrorCode());log.error(Request ID: oe.getRequestId());log.error(Host ID: oe.getHostId());} catch (ClientException ce) {log.error(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);log.error(Error Message: ce.getMessage());}finally {if (byteArrayInputStream!null){try {byteArrayInputStream.close();} catch (IOException e) {e.printStackTrace();}}}return false;}public Boolean uploadFile(String bucketName, String objectName, InputStream inputStream){// 创建PutObjectRequest对象。try {PutObjectRequest putObjectRequest new PutObjectRequest(bucketName, objectName, inputStream);// 如果需要上传时设置存储类型和访问权限请参考以下示例代码。ObjectMetadata metadata new ObjectMetadata();metadata.setHeader(x-oss-forbid-overwrite, true);// metadata.setObjectAcl(CannedAccessControlList.Private);putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result ossClient.putObject(putObjectRequest);log.info(上传成功文件名 {}, objectName);return true;} catch (OSSException oe) {log.error(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);log.error(Error Message: oe.getErrorMessage());log.error(Error Code: oe.getErrorCode());log.error(Request ID: oe.getRequestId());log.error(Host ID: oe.getHostId());} catch (ClientException ce) {log.error(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);log.error(Error Message: ce.getMessage());}finally {if (inputStream!null){try {//其实流已经被关闭了我再关闭一下保险一点inputStream.close();} catch (IOException e) {e.printStackTrace();}}}return false;}public Boolean uploadFile(String objectName, InputStream inputStream){// 创建PutObjectRequest对象。return uploadFile(properties.getBucket(), objectName, inputStream);} }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/87097.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

网站备案 域名证书建立网站和推广

系列文章目录 玩转大语言模型——使用langchain和Ollama本地部署大语言模型 玩转大语言模型——ollama导入huggingface下载的模型 玩转大语言模型——langchain调用ollama视觉多模态语言模型 玩转大语言模型——使用GraphRAGOllama构建知识图谱 玩转大语言模型——完美解决Gra…

如何看网站的版本号上海知名进出口贸易公司

哈喽,大家好,我是雷工! 前些天在新疆哈密时,有天下午有点时间,看离住的宾馆不远就是哈密博物馆,便去逛了逛博物馆,由于接下来的一段时间没顾上记录,趁今天有些时间简单记录下那短暂的…

网站开发前端和后端怎么连接制作个网站需要多少钱

本文精心挑选了10道Python程序员面试题,覆盖了Python的多个核心领域,包括装饰器、lambda函数、列表推导式、生成器、全局解释器锁(GIL)、单例模式以及上下文管理器等。每道题都附有简洁的代码示例,帮助读者更好地理解和应用相关知识点无论是对…

江干区住房和城乡建设局网站中小学网站建设排行2017

时序预测 | Python实现ARIMA-LSTM自回归移动差分模型结合长短期记忆神经网络时间序列预测 目录 时序预测 | Python实现ARIMA-LSTM自回归移动差分模型结合长短期记忆神经网络时间序列预测预测效果基本介绍程序设计参考资料 预测效果 基本介绍 时序预测 | Python实现ARIMA-LSTM自…

电商网站运营建设的目标《企业宣传片制作》

大一开学到现在,我不禁思考一个问题:代码重要吗? 我的答案是,根本不重要,或者说,是次要的。我认为分析问题,和画图是写题的开始,方法的学习,和灵活运用是目的。代码从来…

润滑油 东莞网站建设河南省住房城乡和建设厅网站

本案例介绍了如何通过485modbus转profinet网关连接威纶通与三菱变频器进行modbus通讯。485modbus转profinet网关提供了可靠的连接方式,使用户能够轻松地将不同类型的设备连接到同一网络中。通过使用这种网关,用户可以有效地管理和监控设备,从…

网站新闻页设计wordpress v4

目录 一、前言 二、函数介绍 1.DayOfWeek 枚举定义 2.GetTimeUntilNextTarget 3.GetSpecificWeekdayTime 三、完整代码 四、总结 一、前言 当我们编写代码时,我们经常会遇到需要处理日期和时间的情况。为了更方便地处理这些需求,我们可以创建一个…

四川手机网站建设费用技能培训学校

ORM flask 通过Model操作数据库,不管你的数据库是MySQL还是Sqlite,flask自动帮你生成相应数据库类型的sql语句,所以不需要关注sql语句和类型,对数据的操作flask帮我们自动完成,只需要会写Model就可以了 flask使用对象关…

搜狗网站收录如何做logo标志

YOLOv8 是 YOLO (You Only Look Once) 系列目标检测算法的最新版本,以其高速度和高精度而著称。在电力行业中,绝缘子是电力传输线路上的重要组件之一,它们用于支撑导线并保持电气绝缘。由于长期暴露在户外环境中,绝缘子容易出现损…

网站开发技术方案编写vue适合什么样的网站开发

当问到多线程时候如何解决线程安全的问题时候,大部分人都知道加锁。提到锁最先接触到的就是Synchronized关键字。 当我们想要保证一个共享资源在同一时间只会被一个线程访问到时,我们可以在代码中使用synchronized关键字对类或者对象加锁 synchronized…

做电商网站前期做什么工作网站设计 手写

文章目录 技术交流群1、360 NLP 算法岗2、腾讯 NLP 算法岗3、百度 NLP 算法岗用通俗易懂方式讲解系列 节前,我们组织了一场算法岗技术&面试讨论会,邀请了一些互联网大厂同学、参加社招和校招面试的同学,针对大模型技术趋势、大模型落地项…

大连公司注册网站淮南网站优化

目录 3 地面滤波及单木分割 3.1 地面滤波(Ground Filtering) 3.2 单木分割(Single-Tree Segmentation)

公司建设网站时的注意事项wordpress自定义用户字段

leetcode原题链接&#xff1a;跳跃游戏 II 题目描述 给定一个长度为 n 的 0 索引整数数组 nums。初始位置为 nums[0]。 每个元素 nums[i] 表示从索引 i 向前跳转的最大长度。换句话说&#xff0c;如果你在 nums[i] 处&#xff0c;你可以跳转到任意 nums[i j] 处: 0 < j &…

app网站建设宣传方案提高工作效率英语

您的 Android 设备密码有助于保护您的数据并防止您的个人信息被滥用。但是&#xff0c;如果您被锁定在Android设备之外怎么办&#xff1f;我们知道忘记您的 Android 手机密码是多么令人沮丧&#xff0c;因为它会导致您的设备和数据无法访问。在本技术指南中&#xff0c;我们将向…

汕头网站建设seo外包凡客诚品售后服务

上一篇文章讲了下用工具转换相关的格式&#xff1a;https://blog.csdn.net/weixin_42019349/article/details/134654695 今天来分享一个python库实现上述功能&#xff0c;实现文件转换自由 ^_^ 主角就是pypandoc库 # 安装方式 pip install pypandoc# pypandoc主要有三个函数…

网站前端开发得会什么软件电商平台的设计

作用域 & 上下文 作用域链 - 儿子能用爸爸的东西&#xff0c;调皮的儿子&#xff08;var&#xff09;可以去领居家&#xff08;块级&#xff09;拿东西 面试题&#xff1a; let a globalconsole.log(a)function course() {let b zhaowaconsole.log(b)// 2.6 函数提升 &…

淄博企业建网站在线查询企业

数组删除元素 1.利用新的数组 将原数组arr的元素&#xff0c;复制到新数组newArr中&#xff0c;复制过程中将要删除的元素&#xff0c;选择不复制 public class Test01{public static void main(String [] args){String [] arr {"zhangsan","lisi","…

网站建设主要工作流程在线logo制作生成免费

Pygame是一个流行的Python库&#xff0c;用于开发2D游戏。尽管它主要用于桌面游戏&#xff0c;但通过一些额外的工具和技巧&#xff0c;你也可以使用Pygame来打造多平台游戏&#xff0c;比如支持Windows、Linux、macOS、Android和iOS等平台。 下面是一个简单的Pygame游戏示例&…

怎么在网上卖东西给外国人网站优化需要什么

文章《ArcGIS栅格影像(NDVI)归一化处理的两种方法精解》详细介绍了ArcGIS中进行NDVI影像归一化处理的两种方法,但是无法批量进行,本文就放大招用Python实现批量NDVI归一化处理,大大提高了工作效率,还不赶快Get了? 完整Python代码: import arcpy from arcpy import env…

百度指数网站wordpress菜单显示图片

当涉及到编写自动化测试时&#xff0c;测试框架和工具的选择对于测试用例的设计和执行非常重要。在Python 中&#xff0c;pytest是一种广泛使用的测试框架&#xff0c;它提供了丰富的功能和灵活的扩展性。其中一个很有用的功 能是fixture方法&#xff0c;它允许我们初始化测试环…