Skip to content

Commit c8cfd3b

Browse files
geoffjukeswillmcgugan
authored andcommitted
Added endpoint_url to opener and docs (#11)
* Typo in credential URL syntax * Fixing any typos I see as I find them * add `endpoint_url` to opener, so it can be passed as a URL parameter (for use in open_fs) * added `endpoint_url` examples * copy of README.md * copy of README.md * Reverted to original and added `endpoint_url` example
1 parent 7fcb1dd commit c8cfd3b

4 files changed

Lines changed: 21 additions & 12 deletions

File tree

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@ same way as any other supported filesystem.
1111

1212
Open an S3FS by explicitly using the constructor:
1313

14-
```python
15-
from s3_s3fs import s3FS
16-
s3fs = S3FS('mybucket')
17-
```
18-
19-
Or with a FS URL:
20-
21-
```python
22-
from fs import open_fs
23-
s3fs = open_fs('s3://mybucket')
24-
```
14+
```python
15+
from s3_s3fs import s3FS
16+
s3fs = S3FS('mybucket')
17+
# to use an s3-compatible service
18+
s3fs = S3FS('mybucket', endpoint_url='service.endpoint.url')
19+
```
20+
21+
Or with a FS URL:
22+
23+
```python
24+
from fs import open_fs
25+
s3fs = open_fs('s3://mybucket')
26+
# to use an s3-compatible service
27+
s3fs = open_fs('s3://mybucket?endpoint_url=service.endpoint.url')
28+
```
2529

2630
## Downloading Files
2731

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ Open an S3FS by explicitly using the constructor:
1717
1818
from s3_s3fs import s3FS
1919
s3fs = S3FS('mybucket')
20+
# to use an s3-compatible service
21+
s3fs = S3FS('mybucket', endpoint_url='service.endpoint.url')
2022
2123
Or with a FS URL:
2224

2325
.. code:: python
2426
2527
from fs import open_fs
2628
s3fs = open_fs('s3://mybucket')
29+
# to use an s3-compatible service
30+
s3fs = open_fs('s3://mybucket?endpoint_url=service.endpoint.url')
2731
2832
Downloading Files
2933
-----------------

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ and secret key configured on your system. You may also specify when
5454
creating the filesystem instance. Here's how you would do that with an
5555
opener::
5656

57-
s3fs = open_fs('s3://<access key>:<secret key>/mybucket')
57+
s3fs = open_fs('s3://<access key>:<secret key>@mybucket')
5858

5959
Here's how you specify credentials with the constructor::
6060

fs_s3fs/opener.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ def open_fs(self, fs_url, parse_result, writeable, create, cwd):
2727
dir_path=dir_path or '/',
2828
aws_access_key_id=parse_result.username or None,
2929
aws_secret_access_key=parse_result.password or None,
30+
endpoint_url=parse_result.params.get('endpoint_url', None)
3031
)
3132
return s3fs

0 commit comments

Comments
 (0)