Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consult: Can bucket be instantiated once and used continuously? #382

Open
zengzzzzz opened this issue Feb 23, 2024 · 0 comments
Open

Consult: Can bucket be instantiated once and used continuously? #382

zengzzzzz opened this issue Feb 23, 2024 · 0 comments

Comments

@zengzzzzz
Copy link

>>> import oss2
>>> auth = oss2.Auth('your-access-key-id', 'your-access-key-secret')
>>> bucket = oss2.Bucket(auth, 'http://oss-cn-hangzhou.aliyuncs.com', 'your-bucket')
>>> bucket.put_object('readme.txt', 'content of the object')
<oss2.models.PutObjectResult object at 0x029B9930>

In this example. can I Instantiate a bucket once and use it all the time. like this. and when the auth is sts auth. Thanks

>>> bucket = oss2.Bucket(auth, 'http://oss-cn-hangzhou.aliyuncs.com', 'your-bucket')
>>> bucket.put_object('readme1.txt', 'content of the object')
>>> bucket.put_object('readme2.txt', 'content of the object')
>>> bucket.put_object('readme3.txt', 'content of the object')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant