Skip to content

Commit ff61451

Browse files
committed
Add example for bluemix cos api keys
1 parent fd8146d commit ff61451

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

python/README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ within a DSX Jupyter notebook, you can obtain your account credentials in the fo
3232
If your Object Storage was created with a Softlayer account, each part of the credentials will
3333
be found as text that you can copy and paste into the example code below.
3434

35-
### CloudObjectStorage / Data Science Experience
35+
### Softlayer CloudObjectStorage / Data Science Experience
3636
```python
3737
import ibmos2spark
3838

@@ -50,6 +50,29 @@ object_name = 'file1'
5050
data = sc.textFile(cos.url(object_name, bucket_name))
5151
```
5252

53+
### Bluemix CloudObjectStorage / Data Science Experience
54+
The class CloudObjectStorage allows you to connect to bluemix cos. You can connect to bluemix using api keys
55+
as follows:
56+
57+
```pythonw
58+
import ibmos2spark
59+
60+
# @hidden_cell
61+
credentials = {
62+
'endpoint': 'XXX',
63+
'api_key': 'XXX',
64+
'service_id': 'XXX'
65+
}
66+
67+
configuration_name = 'os_bluemix_cos_config'
68+
cos = ibmos2spark.CloudObjectStorage(sc, credentials, configuration_name, 'bluemix_cos')
69+
70+
bucket_name = 'bucket_name'
71+
object_name = 'file_name'
72+
data = sc.textFile(cos.url(object_name, bucket_name))
73+
```
74+
75+
5376
### Bluemix / Data Science Experience
5477

5578
```python

python/ibmos2spark/osconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def __init__(self, sparkcontext, credentials, configuration_name='', cos_type='s
188188
* endpoint [required]
189189
* service_id [required]
190190
* api_key OR iam_token depends on the selected authorization method (auth_method) [required]
191-
* iam_service_endpoint [optional]
191+
* iam_service_endpoint [optional] (default: https://iam.ng.bluemix.net/oidc/token)
192192
* v2_signer_type [optional]
193193
194194
configuration_name [optional]: string that identifies this configuration. You can

0 commit comments

Comments
 (0)