Conversation
Create oss.py
add oss reader
add alicloud oss reader, singlePartReader, multiPartReader
wip: adding oss test code, support oss read and write
Collaborator
|
Hi, had a brief look at the changes, looks like you're on the right track. Let me know when the code is ready for a review. Thanks! |
|
Any updates? |
Collaborator
|
Accessing Alibaba Cloud OSS using boto3 is officially supported meaning you can also use boto3's automatic credential discovery like smart_open usually does: import boto3
from botocore.config import Config
oss_client = boto3.client(
's3',
endpoint_url='https://s3.oss-cn-hongkong.aliyuncs.com',
config=Config(
signature_version='s3', # no chunked encoding
s3={"addressing_style": "virtual"},
# may be required for boto3 >= 1.36.0 with third-party S3
# https://github.com/boto/boto3/issues/4400#issuecomment-2600742103
request_checksum_calculation='when_required',
response_checksum_validation='when_required',
)
)
transport_params = {'client': oss_client}
with open(f's3://bucket/test.txt', 'r', transport_params=transport_params) as fin:
print("smart_open read success:")With this MWE, I'll close this PR, analogous to #824 and other third party s3-compatible storage systems. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
Support Alicloud OSS
Motivation
I am currently working for alibaba, and I encounter marvelous smartopen lib when I am coding. However, it doesn't support Alicloud OSS.
So I figured I should add oss support myself.
Contributing to opensource community is always my dream.
Tests
still working on integration tests.
Work in progress
70% finished, would love to hear your comments.
Checklist
Before you create the PR, please make sure you have: