Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
boto s3 Bucket versus get_bucket

I try to access a key inside a bucket, for which I don't have permissions, though I do for the key. In order to be able to do get_key('this/is/my_key'), I need the bucket object:

conn = boto.connect_s3(key, secret_key)
my_bucket = conn.get_bucket('a_bucket')

yields S3ResponseError: S3ResponseError: 403 Forbidden.

On the other hand, the following works

my_bucket = boto.s3.bucket.Bucket(conn, 'a_bucket')
my_bucket.get_key('this/is/my_key')

Question: What is the difference between creating the object Bucket and using the get_bucket method? Checking the docu I only see the check for validation. Anything else?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Validation (validate=True default) in the get_bucket checks for bucket's existence when called. Since you don't have access to the bucket, your request is turned down (403). In the other case, the class instantiation doesn't seem to do the validation, hence the get_key method works as intended.

over 4 years ago · Santiago Trujillo Relatório

0

get_bucket() need s3:listObject permission

get_key() only need s3:GetObject permission

Thus following line DOES NOT create any bucket.

my_bucket = boto.s3.bucket.Bucket(conn, 'a_bucket')

It just create a python object class pointing to the bucket. There is no error as long as you didn't perform any bucket related task. If you can do a get_key() without error, it's mean you are given the s3:GetObject permission to the bucket.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda