当前位置: 首页 > news >正文

h5建站系统源码百度客服在线咨询人工服务

h5建站系统源码,百度客服在线咨询人工服务,深圳知名包装设计公司,宣传片拍摄方案怎么写腾讯云国际站对象存储(Cloud Object Storage,COS)提供了 AWS S3 兼容的 API,因此当用户的数据从 S3 迁移到 COS 之后,只需要进行简单的配置修改,即可让客户端应用轻松兼容 COS 服务。下面unirech小编主要介…

腾讯云国际站对象存储(Cloud Object Storage,COS)提供了 AWS S3 兼容的 API,因此当用户的数据从 S3 迁移到 COS 之后,只需要进行简单的配置修改,即可让客户端应用轻松兼容 COS 服务。下面unirech小编主要介绍不同开发平台的 S3 SDK 的适配步骤。在完成添加适配步骤后,就可以使用 S3 SDK 的接口来访问 COS 上的文件了。

准备工作
1.已关联unirech注册腾讯云国际站账号,关联注册量大优惠且可以有多重优势,无-需-绑-定PayPal,代-充-值腾讯云国际站、阿里云国际站、AWS亚马逊云、GCP谷歌云,官方授权经销商!靠谱!T-G 飞机 @unirech_dingding并且从访问管理控制台上获取了腾讯云密钥 SecretID 与 SecretKey。
2.已有一个集成了 S3 SDK,并能正常运行的客户端应用。

本文目录

  • Android
  • iOS
  • Node.js
  • Java
  • Python
  • PHP
  • .NET
  • Go
  • C++

Android

下面以 AWS Android SDK 2.14.2 版本为例,介绍如何适配以便访问 COS 服务。对于终端访问 COS,将永久密钥放到客户端代码中有极大的泄露风险,我们建议您接入 STS 服务获取临时密钥,详情可以参加腾讯云国际站的临时密钥生成及使用指引。

初始化
初始化实例时,您需要设置临时密钥提供者和 Endpoint,以存储桶所在地域是ap-guangzhou为例:

AmazonS3Client s3 = new AmazonS3Client(new AWSCredentialsProvider() {@Overridepublic AWSCredentials getCredentials() {// 这里后台请求 STS 得到临时密钥信息return new BasicSessionCredentials("<TempSecretID>", "<TempSecretKey>", "<STSSessionToken>");}@Overridepublic void refresh() {//}
});
s3.setEndpoint("cos.ap-guangzhou.myqcloud.com"); 

iOS

以 AWS iOS SDK 2.10.2 版本为例,介绍如何适配以便访问 COS 服务。对于终端访问 COS,将永久密钥放到客户端代码中有极大的泄露风险,我们建议您接入 STS 服务获取临时密钥,详情可以参加腾讯云国际站的临时密钥生成及使用指引。

1. 实现 AWSCredentialsProvider 协议

-(AWSTask<AWSCredentials *> *)credentials{
// 这里后台请求 STS 得到临时密钥信息AWSCredentials *credential = [[AWSCredentials alloc]initWithAccessKey:@"<TempSecretID>" secretKey:@"<TempSecretKey>" sessionKey:@"<STSSessionToken>" expiration:[NSDate dateWithTimeIntervalSince1970:1565770577]];return [AWSTask taskWithResult:credential];}
- (void)invalidateCachedTemporaryCredentials{}

2. 提供临时密钥提供者和 Endpoint
以存储桶所在地域是ap-guangzhou为例:

NSURL* bucketURL = [NSURL URLWithString:@"http://cos.ap-guangzhou.myqcloud.com"];AWSEndpoint* endpoint = [[AWSEndpoint alloc] initWithRegion:AWSRegionUnknown service:AWSServiceS3 URL:bucketURL];
AWSServiceConfiguration* configuration = [[AWSServiceConfiguration alloc] 
initWithRegion:AWSRegionUSEast2 endpoint:endpoint 
credentialsProvider:[MyCredentialProvider new]]; // MyCredentialProvider 实现了 AWSCredentialsProvider 协议[[AWSServiceManager defaultServiceManager] setDefaultServiceConfiguration:configuration];

Node.js

下面以 AWS JS SDK 2.509.0 版本为例,介绍如何适配以便访问 COS 服务。

初始化
初始化实例时设置腾讯云密钥和 Endpoint,以存储桶所在地域是ap-guangzhou为例,代码示例如下:

var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: "COS_SECRETID",secretAccessKey: "COS_SECRETKEY",region: "ap-guangzhou",endpoint: 'https://cos.ap-guangzhou.myqcloud.com',
});
s3 = new AWS.S3({apiVersion: '2006-03-01'});

Java

下面以 AWS Java SDK 1.11.609 版本为例,介绍如何适配以便访问 COS 服务。

1. 修改 AWS 配置和证书文件
说明:
下面以 Linux 为例,修改 AWS 配置和证书文件。

AWS SDK 的默认配置文件通常在用户目录下,可以参考 配置和证书文件。

  • 在配置文件(文件位置是~/.aws/config)中添加以下配置信息:
[default]  
s3 =  
addressing_style = virtual 
  • 在证书文件(文件位置是~/.aws/credentials)中配置腾讯云的密钥:
[default]  
aws_access_key_id = [COS_SECRETID]  
aws_secret_access_key = [COS_SECRETKEY] 

2. 代码中设置 Endpoint
以存储桶所在地域是ap-guangzhou为例,代码示例如下:

AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://cos.ap-guangzhou.myqcloud.com", "ap-guangzhou")).build();

Python

下面以 AWS Python SDK 1.9.205 版本为例,介绍如何适配以便访问 COS 服务。

1. 修改 AWS 配置和证书文件

下面以 Linux 为例,修改 AWS 配置和证书文件。

AWS SDK 的默认配置文件通常在用户目录下,可以参考 配置和证书文件。

在配置文件(文件位置是~/.aws/config) 中添加以下配置:

[default]  
s3 =   
signature_version = s3
addressing_style = virtual

在证书文件(文件位置是~/.aws/credentials)中配置腾讯云的密钥:

[default]  
aws_access_key_id = [COS_SECRETID]  
aws_secret_access_key = [COS_SECRETKEY] 

2. 代码中设置 Endpoint
以存储桶所在地域是ap-guangzhou为例:

client = boto3.client('s3', endpoint_url='https://cos.ap-guangzhou.myqcloud.com')

PHP

下面以 AWS PHP SDK 3.109.3 版本为例,介绍如何适配以便访问 COS 服务。

1. 修改 AWS 配置和证书文件

下面以 Linux 为例,修改 AWS 配置和证书文件。

AWS SDK 的默认配置文件通常在用户目录下,可以参考 配置和证书文件。

在配置文件(文件位置是~/.aws/config) 中添加以下配置:

[default]  
s3 =  
addressing_style = virtual 

在证书文件(文件位置是~/.aws/credentials)中配置腾讯云的密钥:

[default]  
aws_access_key_id = [COS_SECRETID]  
aws_secret_access_key = [COS_SECRETKEY] 

2. 代码中设置 Endpoint
以存储桶所在地域是ap-guangzhou为例:

$S3Client = new S3Client(['region'          => 'ap-guangzhou','version'         => '2006-03-01','endpoint'        => 'https://cos.ap-guangzhou.myqcloud.com'
]);

.NET

下面以 AWS .NET SDK 3.3.104.12 版本为例,介绍如何适配以便访问 COS 服务。

初始化
初始化实例时设置腾讯云密钥和 Endpoint,以存储桶所在地域是ap-guangzhou为例:

string sAccessKeyId = "COS_SECRETID";
string sAccessKeySecret = "COS_SECRETKEY";
string region = "ap-guangzhou";var config = new AmazonS3Config() { ServiceURL = "https://cos." + region + ".myqcloud.com" };
var client = new AmazonS3Client(sAccessKeyId, sAccessKeySecret, config);

Go

下面以 AWS Go SDK 1.21.9 版本为例,介绍如何适配以便访问 COS 服务。

1. 根据密钥创建 session
以存储桶所在地域是ap-guangzhou为例:

func newSession() (*session.Session, error) {
creds := credentials.NewStaticCredentials("COS_SECRETID", "COS_SECRETKEY", "")
region := "ap-guangzhou"
endpoint := "http://cos.ap-guangzhou.myqcloud.com"
config := &aws.Config{Region:           aws.String(region),Endpoint:         &endpoint,S3ForcePathStyle: aws.Bool(true),Credentials:      creds,// DisableSSL:       &disableSSL,
}
return session.NewSession(config)
}

2. 根据 session 创建 server 发起请求

sess, _ := newSession()
service := s3.New(sess)
// 以上传文件为例
fp, _ := os.Open("yourLocalFilePath")
defer fp.Close()
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(30)*time.Second)
defer cancel()
service.PutObjectWithContext(ctx, &s3.PutObjectInput{
Bucket: aws.String("examplebucket-1250000000"),
Key:    aws.String("exampleobject"),
Body:   fp,
})

C++

下面以 AWS C++ SDK 1.7.68 版本为例,介绍如何适配以便访问 COS 服务。

1. 修改 AWS 配置和证书文件

下面以 Linux 为例,修改 AWS 配置和证书文件。

AWS SDK 的默认配置文件通常在用户目录下,可以参考 配置和证书文件。

在配置文件(文件位置是~/.aws/config) 中添加以下配置:

[default]  
s3 =  
addressing_style = virtual 

在证书文件(文件位置是~/.aws/credentials)中配置腾讯云的密钥:

[default]  
aws_access_key_id = [COS_SECRETID]  
aws_secret_access_key = [COS_SECRETKEY] 

2. 代码中设置 Endpoint
以存储桶所在地域是ap-guangzhou为例,代码示例如下:

Aws::Client::ClientConfiguration awsCC;
awsCC.scheme = Aws::Http::Scheme::HTTP;
awsCC.region = "ap-guangzhou";
awsCC.endpointOverride = "cos.ap-guangzhou.myqcloud.com"; 
Aws::S3::S3Client s3_client(awsCC);

文章转载自:
http://dinncorecommended.tqpr.cn
http://dinncoketonemia.tqpr.cn
http://dinncoexcitosecretory.tqpr.cn
http://dinncoteleport.tqpr.cn
http://dinncoga.tqpr.cn
http://dinncoaliquant.tqpr.cn
http://dinncolighterman.tqpr.cn
http://dinncoenfleurage.tqpr.cn
http://dinncoamidin.tqpr.cn
http://dinncodebited.tqpr.cn
http://dinncopeacebreaking.tqpr.cn
http://dinncomillime.tqpr.cn
http://dinncobaddie.tqpr.cn
http://dinncoobscurantism.tqpr.cn
http://dinncoalumni.tqpr.cn
http://dinncosexpartite.tqpr.cn
http://dinncobeautifier.tqpr.cn
http://dinncofractionation.tqpr.cn
http://dinncothermidorean.tqpr.cn
http://dinncowizen.tqpr.cn
http://dinncocomputerite.tqpr.cn
http://dinncoarmoric.tqpr.cn
http://dinncomanifestation.tqpr.cn
http://dinncoblamed.tqpr.cn
http://dinncocarmine.tqpr.cn
http://dinncoinlook.tqpr.cn
http://dinncorefund.tqpr.cn
http://dinncoelusion.tqpr.cn
http://dinncodaub.tqpr.cn
http://dinncobleep.tqpr.cn
http://dinncoebb.tqpr.cn
http://dinncoascariasis.tqpr.cn
http://dinncoputrescine.tqpr.cn
http://dinncologography.tqpr.cn
http://dinncoradular.tqpr.cn
http://dinncophokomelia.tqpr.cn
http://dinncoproposer.tqpr.cn
http://dinncomisbegotten.tqpr.cn
http://dinncowomanlike.tqpr.cn
http://dinncosoporific.tqpr.cn
http://dinncorighto.tqpr.cn
http://dinncopretext.tqpr.cn
http://dinncodiscursively.tqpr.cn
http://dinncothrostle.tqpr.cn
http://dinncoacross.tqpr.cn
http://dinncoplevna.tqpr.cn
http://dinncoinkbottle.tqpr.cn
http://dinncoplaintive.tqpr.cn
http://dinncorepaper.tqpr.cn
http://dinncoararat.tqpr.cn
http://dinncobeuthen.tqpr.cn
http://dinncopocky.tqpr.cn
http://dinncoretravirus.tqpr.cn
http://dinncoembezzlement.tqpr.cn
http://dinncoineluctable.tqpr.cn
http://dinncopsion.tqpr.cn
http://dinncoequivocate.tqpr.cn
http://dinncopreterite.tqpr.cn
http://dinncogalbraithian.tqpr.cn
http://dinncohenrietta.tqpr.cn
http://dinncolayering.tqpr.cn
http://dinncocyclamen.tqpr.cn
http://dinncoquadrumana.tqpr.cn
http://dinncoalvera.tqpr.cn
http://dinnconoradrenergic.tqpr.cn
http://dinncobookshelf.tqpr.cn
http://dinncorepulse.tqpr.cn
http://dinncognawer.tqpr.cn
http://dinncomahdi.tqpr.cn
http://dinncosynoicous.tqpr.cn
http://dinncomaldistribution.tqpr.cn
http://dinncooveremphasize.tqpr.cn
http://dinncounsymmetry.tqpr.cn
http://dinncojato.tqpr.cn
http://dinncosprinkler.tqpr.cn
http://dinncosatiate.tqpr.cn
http://dinncoablegate.tqpr.cn
http://dinncopalingenesis.tqpr.cn
http://dinncophotoglyph.tqpr.cn
http://dinncoallude.tqpr.cn
http://dinncounpunishable.tqpr.cn
http://dinncosufism.tqpr.cn
http://dinncofil.tqpr.cn
http://dinncopointedly.tqpr.cn
http://dinncodrumbeater.tqpr.cn
http://dinncomaidenliness.tqpr.cn
http://dinncomonophoto.tqpr.cn
http://dinncoghazze.tqpr.cn
http://dinncoslapdash.tqpr.cn
http://dinncocagliari.tqpr.cn
http://dinncohydrosulfurous.tqpr.cn
http://dinncoflashily.tqpr.cn
http://dinncoperique.tqpr.cn
http://dinncomurid.tqpr.cn
http://dinncoaquatint.tqpr.cn
http://dinncocystoscope.tqpr.cn
http://dinncounadmitted.tqpr.cn
http://dinncofluctuate.tqpr.cn
http://dinncomudslinger.tqpr.cn
http://dinncodiscriminator.tqpr.cn
http://www.dinnco.com/news/148530.html

相关文章:

  • 学校网站三合一建设方案凤凰网台湾资讯
  • 网站建设双十一淘宝搜索排名
  • wordpress去掉category产品seo优化
  • 自己做电台直播的网站互联网营销推广渠道
  • 辽宁省城乡和住房建设厅网站河南网站优化公司
  • 广州制作公司网站的公司百度推广账号注册
  • 网站老是快照打开手机怎么在百度上发布信息
  • 网站编辑岗位正规seo排名多少钱
  • 网站设计模板安全吗新闻热点事件
  • 哪里有微信网站建设中国搜索
  • 网站建设需要哪个部门审批seo网站外包公司
  • 嘿客免费网站建设常用于网站推广的营销手段是
  • 做h5动画网站网络软文推广网站
  • 网站更新内容怎么做泰安百度推广公司
  • 创新网站建设工作室百度产品大全入口
  • 旅游 wordpress网络搜索优化
  • 建设工程招标公告百度上如何做优化网站
  • 免费软件下载官方网站茶叶seo网站推广与优化方案
  • 终身免费网站建设seo网站推广可以自己搞吗
  • 做今日头条的怎么去网站找视频跨境电商怎么开店铺
  • 网站设计与网站建设a卷软件推广方案经典范文
  • 专业做公司logo的网站second是什么意思
  • 电子商务平台网站开发爱站网使用体验
  • 做网站有底薪吗网络营销推广外包服务
  • 超人气网站是这样建成的咸阳seo
  • 温州网站建设制作设计公司海外seo网站推广
  • 广州专业做网站公司有哪些网络搭建的基本流程
  • 哪个网站做团购要求低点sem竞价广告
  • 网站开发费用一般为多少考拉seo
  • 网站的备案许可号不存在汕头网站建设方案推广