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

226
Visualizações
How to create a URL for a s3 photo without expiration?

I'm using a Django User models to store my users. My user will have the usual: name, username, password.

Here's an example:

class UserProfile(models.Model):
    user = models.OneToOneField(User, primary_key=True)
    photo_url = models.CharField(max_length=200, blank=True, default='') # the url to fetch photo

There will be one field that I will need to generate a url for and that is the url for the photo he uploaded to S3, that way my client can download it and display it.

What's the best way to generate an indefinite url in boto3?

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

0

From: Generating Presigned URLs. There is no way to specify a non-expiring URL. Use a large int value for ExpiresIn parameter. Try it.

import boto3
import requests

# Get the service client.
s3 = boto3.client('s3')

# Generate the URL to get 'key-name' from 'bucket-name'
url = s3.generate_presigned_url(
    ClientMethod='get_object',
    Params={
        'Bucket': 'bucket-name',
        'Key': 'key-name'
    },
    ExpiresIn=9999999999
)
over 4 years ago · Santiago Trujillo Relatório

0

actually we cannot create a presigned url without expiration ,the maximum period of expiration is one week for S3 version 4 and for v2 it might be higher .

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