!pwd # See what is your Notebook working dir
!ls -l /gpfs/fs02/user/sage-238afb16dd780d-157372a85d46/notebook/work # <-- Your specific Notebook working dir here
# https://dataplatform.ibm.com/analytics/notebooks/v2/ee1d0b44-0fce-4cf6-8545-e1dc961d0668/view?access_token=c0489b861ab65f63be7e3c5ce962003a2a0197660e67ecb140c477c2e11b5fe3
from ibm_botocore.client import Config
import ibm_boto3
def download_file_cos( credentials, local_file_name, key ):
    cos = ibm_boto3.client( service_name            = 's3',
                            ibm_api_key_id          = credentials['IBM_API_KEY_ID'],
                            ibm_service_instance_id = credentials['IAM_SERVICE_ID'],
                            ibm_auth_endpoint       = credentials['IBM_AUTH_ENDPOINT'],
                            config=Config(signature_version = 'oauth'),
                            endpoint_url            = credentials['ENDPOINT'] )
    try:
        cos.download_file( Bucket   = credentials['BUCKET'],
                           Key      = key,
                           Filename = local_file_name)
    except Exception as e:
        print( Exception, e )
    else:
        print( 'File Downloaded' )
