Skip to content

Commit

Permalink
Add example for connecting to bluemix cos using IAM token
Browse files Browse the repository at this point in the history
  • Loading branch information
bassel-zeidan committed Oct 2, 2017
1 parent ff61451 commit 50c424b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ object_name = 'file_name'
data = sc.textFile(cos.url(object_name, bucket_name))
```

Alternatively, you can connect to bluemix cos using IAM token. Example:
```pythonw
import ibmos2spark
# @hidden_cell
credentials = {
'endpoint': 'XXX',
'iam_token': 'eyJraWQXXXX .... X',
'service_id': 'XXX'
}
configuration_name = 'os_bluemix_cos_config'
cos = ibmos2spark.CloudObjectStorage(sc, credentials, configuration_name, 'bluemix_cos', 'iam_token')
bucket_name = 'bucket_name'
object_name = 'file_name'
data = sc.textFile(cos.url(object_name, bucket_name))
```


### Bluemix / Data Science Experience

Expand Down

0 comments on commit 50c424b

Please sign in to comment.