Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(1) If you aren't connecting to EUMETSAT buckets, or a bucket someone shared with you, you can probably skip this partnext code block.  Now, if the bucket is located at another project (e.g. someone is sharing their bucket with you), you probably need to denote the bucket name with project_id:bucketname. For boto3 to be able to use that kind of naming convention, we need to use a small trick. 

Code Block
languagepy
from botocore.session import Session
from botocore.handlers import validate_bucket_name

#This is a neat trick that allows us to specify our bucket name in terms of ProjectID:bucketname
bucketname = project_id + ':' + bucketname
botocore_session = Session()
botocore_session.unregister('before-parameter-build.s3', validate_bucket_name)
boto3.setup_default_session(botocore_session = botocore_session)

Now on to the general tutorial; lets start by initializing the S3 client with our access keys and endpoint:

...