Oos Picture Python Reference

Source: Internet
Author: User

Https://www.aliyun.com/act/aliyun/ossdoc.html?spm=5176.2020520105.103.16.jWqRON
OSS provides an interface, a bucket has more than one object, you can upload a picture of the object, access, can be set by the console image style, and then the OSS provides interface API, you can use this API to make picture calls and access



bucket = ' Image-demo ' 
object = ' example.jpg ' 
query = ' 100w_100h.jpg ' 
Object = object + ' @ ' + query 
self.oss.get_object (Bucket, object)



Generate AK in the security token shortcut configuration


It's actually here.


Http://oss-cn-hangzhou.aliyuncs.com

Endpoint:endpoint represents the access domain name of the OSS external service,<p>yuzhixingxikeji.oss-cn-shanghai.aliyuncs.com</p>
That's the thing.


Oh, this time, it's endpoint.


ImportOss2
Auth= Oss2. Auth(' id ',' Password ')
Service= Oss2. Service(Auth' Endpoint ')
Print([B.name forBinchOss2. Bucketiterator(Service)])
This error was reported after AccessKey was created.oss2.exceptions.AccessDenied: {' status ': 403, ' details ': {' HostId ': ' oss-cn-shanghai.aliyuncs.com ', ' Message ': ' AccessDenied ', ' Code ': ' AccessDenied ', ' RequestID ': ' 5714de70c50250a33efb22a6}
The reason is that this is a sub-account access, but the bucket owner does not give you access permissions
So we need to set up the accesskey in the creation of the permissions, I put the user and the group are all permissions, and then the normal access to the


 fromItertoolsImportIslice forBinchIslice (Oss2. Objectiterator (Bucket),Ten): Print (B.key)
This is the original
Oss2. Bucket(' http://oss-cn-hangzhou.aliyuncs.com ',' Yuzhixingxikeji ')
This is now.
Oss2. Bucket(' http://oss-cn-shanghai.aliyuncs.com ',' Yuzhixingxikeji ')
I did not find this, the original example of the endpoint did not change over, lying trough










From for notes (Wiz)

Oos Picture Python Reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.