Skip to content

Commit 50c424b

Browse files
committed
Add example for connecting to bluemix cos using IAM token
1 parent ff61451 commit 50c424b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

python/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ object_name = 'file_name'
7272
data = sc.textFile(cos.url(object_name, bucket_name))
7373
```
7474

75+
Alternatively, you can connect to bluemix cos using IAM token. Example:
76+
```pythonw
77+
import ibmos2spark
78+
79+
# @hidden_cell
80+
credentials = {
81+
'endpoint': 'XXX',
82+
'iam_token': 'eyJraWQXXXX .... X',
83+
'service_id': 'XXX'
84+
}
85+
86+
configuration_name = 'os_bluemix_cos_config'
87+
cos = ibmos2spark.CloudObjectStorage(sc, credentials, configuration_name, 'bluemix_cos', 'iam_token')
88+
89+
bucket_name = 'bucket_name'
90+
object_name = 'file_name'
91+
data = sc.textFile(cos.url(object_name, bucket_name))
92+
```
93+
7594

7695
### Bluemix / Data Science Experience
7796

0 commit comments

Comments
 (0)