Python sample script for connecting to Tealium's S3 Bucket?

Michael_Kim_shc
Silver Contributor
Silver Contributor Michael_Kim_shc

Any chance that anyone out there has a quick and easy sample python script to pull from Tealium's S3 Bucket given a location/bucket string similar to below:

collect-us-east-1.tealium.com/bulk-downloader/acme_main

(I'm trying to send up omnichannel files, but am getting errors related to bucket not existing in my python/boto script.)

 

4 REPLIES 4

Python sample script for connecting to Tealium's S3 Bucket?

Tealium Employee

@Michael_Kim_shc quick clarification. Your question initially states "pull from" whereas the comment at the end states "send up". Can you clarify which?

 

I assume you mean upload. If you didn't check stackoverflow, they usually have great snippets. Here is one I found with 3 possible methods for upload so hopefully one helps:
http://stackoverflow.com/questions/15085864/how-to-upload-a-file-to-directory-in-s3-bucket-using-bot...

 

I have noticed in the past that it is not possible to access root on our S3 instance, so please be sure to point directly to the directory.

 

Also, please make sure the path is correct. It should be like:

https://<key>@s3.amazonaws.com/collect-<region>.tealium.com/bulk-downloader/<account>-<profile>

Python sample script for connecting to Tealium's S3 Bucket?

Michael_Kim_shc
Silver Contributor
Silver Contributor Michael_Kim_shc

Hey @dan_george,

I feel like I should know this easily - but i don't unfortunately.. I think my main issue is that I don't understand from the string below where the name of my bucket is, and what the value/name of my prefix is.

collect-us-east-1.tealium.com/bulk-downloader/acmeMain

(this is what is given to me in the omnichannel setup)

I've tried all the domain, "bulk-downloader" and "acmeMain" separately, and together in various other combinations - but each time i get a "bucket doesn't exist" error.  It also seems that boto is trying too prepend whatever bucketname i set to the general AWS connection URL: s3.amazonaws.com

 

To answer you earlier question, yes - i'm trying to load files into the Tealium S3 bucket for omnichannel to parse.

thx!

 

 

Python sample script for connecting to Tealium's S3 Bucket?

Tealium Employee

Here is a breakdown that might be useful:

 

CREDS = {
    'AWS' : {
        'bucket' : 'collect-us-east-1.tealium',
        'access_key':'AKIA...',
        'secret_key':'h68hDxK...',
        'prefix' : 'account/profile/',
        'local_path' : '~/Downloads/'
    }
}

 

***DISCLAIMER: TEALIUM IS NOT RESPONSIBLE FOR USE OF THE ATTACHED SCRIPT***

I've attached a Python script that I've used previously as a foundation to connect to S3 but this was for downloading files, not uploading. I'm sure it can easily be changed to upload, but should at least get you on the right path. I hope. Let me know if you're successful.

 

Python sample script for connecting to Tealium's S3 Bucket?

Michael_Kim_shc
Silver Contributor
Silver Contributor Michael_Kim_shc

Hey @dan_george,

Thanks so much!  That was the info I needed, and the code snippet helped as well.