Skip to content

Commit

Permalink
Added endpoint_url to opener and docs (#11)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
geoffjukes authored and willmcgugan committed Oct 19, 2017
1 parent 7fcb1dd commit c8cfd3b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ same way as any other supported filesystem.

Open an S3FS by explicitly using the constructor:

```python
from s3_s3fs import s3FS
s3fs = S3FS('mybucket')
```

Or with a FS URL:

```python
from fs import open_fs
s3fs = open_fs('s3://mybucket')
```
```python
from s3_s3fs import s3FS
s3fs = S3FS('mybucket')
# to use an s3-compatible service
s3fs = S3FS('mybucket', endpoint_url='service.endpoint.url')
```

Or with a FS URL:

```python
from fs import open_fs
s3fs = open_fs('s3://mybucket')
# to use an s3-compatible service
s3fs = open_fs('s3://mybucket?endpoint_url=service.endpoint.url')
```

## Downloading Files

Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ Open an S3FS by explicitly using the constructor:
from s3_s3fs import s3FS
s3fs = S3FS('mybucket')
# to use an s3-compatible service
s3fs = S3FS('mybucket', endpoint_url='service.endpoint.url')
Or with a FS URL:

.. code:: python
from fs import open_fs
s3fs = open_fs('s3://mybucket')
# to use an s3-compatible service
s3fs = open_fs('s3://mybucket?endpoint_url=service.endpoint.url')
Downloading Files
-----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ and secret key configured on your system. You may also specify when
creating the filesystem instance. Here's how you would do that with an
opener::

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

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

Expand Down
1 change: 1 addition & 0 deletions fs_s3fs/opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ def open_fs(self, fs_url, parse_result, writeable, create, cwd):
dir_path=dir_path or '/',
aws_access_key_id=parse_result.username or None,
aws_secret_access_key=parse_result.password or None,
endpoint_url=parse_result.params.get('endpoint_url', None)
)
return s3fs

0 comments on commit c8cfd3b

Please sign in to comment.