This is an automated email from the ASF dual-hosted git repository.
manjusaka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 1c3e7978c chore: clearer doc for python binding (#3667)
1c3e7978c is described below
commit 1c3e7978c7a47c0609cd9c3c1b57856c3db94e71
Author: congyi wang <[email protected]>
AuthorDate: Fri Nov 24 21:33:02 2023 +0800
chore: clearer doc for python binding (#3667)
---
bindings/python/README.md | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/bindings/python/README.md b/bindings/python/README.md
index b3a515d51..72641a777 100644
--- a/bindings/python/README.md
+++ b/bindings/python/README.md
@@ -18,6 +18,7 @@ pip install opendal
## Usage
+fs service example:
```python
import opendal
@@ -40,6 +41,30 @@ async def main():
asyncio.run(main())
```
+s3 service example:
+```python
+import opendal
+
+op = opendal.Operator("s3", root="/tmp", bucket="your_bucket_name",
region="your_region")
+op.write("test.txt", b"Hello World")
+print(op.read("test.txt"))
+print(op.stat("test.txt").content_length)
+```
+
+Or using the async API:
+
+```python
+import asyncio
+
+async def main():
+ op = opendal.AsyncOperator("s3", root="/tmp", bucket="your_bucket_name",
region="your_region")
+ await op.write("test.txt", b"Hello World")
+ print(await op.read("test.txt"))
+
+asyncio.run(main())
+```
+
+
## Development
Setup virtualenv: