From 50c424bd4ab469efe61db9ae73ef296dce1e92ae Mon Sep 17 00:00:00 2001 From: Bassel Zeidan Date: Mon, 2 Oct 2017 16:56:49 +0200 Subject: [PATCH] Add example for connecting to bluemix cos using IAM token --- python/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/python/README.md b/python/README.md index 5a6b44b..dc3a2ae 100644 --- a/python/README.md +++ b/python/README.md @@ -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