Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Add cache-control header for object in S3?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matt Billenstein  
View profile  
 More options Sep 15 2010, 6:06 am
From: Matt Billenstein <m...@vazor.com>
Date: Wed, 15 Sep 2010 03:06:58 -0700
Local: Wed, Sep 15 2010 6:06 am
Subject: Add cache-control header for object in S3?
Other than uploading the object fresh to S3, is there a way to set a
cache-control header?

Right now I'm doing something like:

key.set_contents_from_filename(path, policy='public-read', headers={'Cache-Control': 'max-age=14400'})

When I upload a new file...

m

--
Matt Billenstein
m...@vazor.com
http://www.vazor.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Moyer  
View profile  
 More options Sep 15 2010, 12:31 pm
From: Chris Moyer <koper...@gmail.com>
Date: Wed, 15 Sep 2010 12:31:28 -0400
Local: Wed, Sep 15 2010 12:31 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?
Does this not work or are you asking for something more like:

 key.set_contents_from_filename(path, policy='public-read',
cache_control='4400')

--
Chris Moyer

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Billenstein  
View profile  
 More options Sep 15 2010, 1:22 pm
From: Matt Billenstein <m...@vazor.com>
Date: Wed, 15 Sep 2010 10:22:33 -0700
Local: Wed, Sep 15 2010 1:22 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?

On Wed, Sep 15, 2010 at 12:31:28PM -0400, Chris Moyer wrote:
> Does this not work or are you asking for something more like:

My example works and I think the interface is fine, but I was wondering
if there was a way to set a header on a file that's already in s3
without uploading it again.

m

--
Matt Billenstein
m...@vazor.com
http://www.vazor.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Moyer  
View profile  
 More options Sep 15 2010, 1:25 pm
From: Chris Moyer <koper...@gmail.com>
Date: Wed, 15 Sep 2010 13:25:03 -0400
Local: Wed, Sep 15 2010 1:25 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?
Ahh, yeah, that's been a long discussion on here before too. You can
do it, but it's essentially done by copying the file over itself. See
http://groups.google.com/group/boto-users/browse_thread/thread/2d830d...

--
Chris Moyer

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mitchell Garnaat  
View profile  
 More options Sep 15 2010, 1:26 pm
From: Mitchell Garnaat <mi...@garnaat.com>
Date: Wed, 15 Sep 2010 13:26:19 -0400
Local: Wed, Sep 15 2010 1:26 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?

But at least using the COPY operation doesn't require you to re-upload the
file.

Mitch


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Billenstein  
View profile  
 More options Sep 15 2010, 3:34 pm
From: Matt Billenstein <m...@vazor.com>
Date: Wed, 15 Sep 2010 12:34:15 -0700
Local: Wed, Sep 15 2010 3:34 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?

On Wed, Sep 15, 2010 at 01:25:03PM -0400, Chris Moyer wrote:
> Ahh, yeah, that's been a long discussion on here before too. You can
> do it, but it's essentially done by copying the file over itself. See
> http://groups.google.com/group/boto-users/browse_thread/thread/2d830d...

To follow up -- I think this works properly:

>>> k2.copy(bucket.name, k2.key, metadata={'Content-Type' : 'image/jpeg', 'Cache-Control' : 'max-age=3601'})

<Key: static.flingo.tv,02/02100c0c-4e8d-11df-8480-123139023132/me.jpg>

>>> k3 = _
>>> k3.set_acl('public-read')

The ACL doesn't seem to be preserved across the copy, so it needs to be
reset...

m

--
Matt Billenstein
m...@vazor.com
http://www.vazor.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mitchell Garnaat  
View profile  
 More options Sep 15 2010, 3:40 pm
From: Mitchell Garnaat <mi...@garnaat.com>
Date: Wed, 15 Sep 2010 15:40:36 -0400
Local: Wed, Sep 15 2010 3:40 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?

There is a "preserve_acl" boolean param to the copy method that will handle
this for you.  It basically does the same think you are doing already but
saves you a bit of work.

Mitch


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Moyer  
View profile  
 More options Sep 15 2010, 3:44 pm
From: Chris Moyer <koper...@gmail.com>
Date: Wed, 15 Sep 2010 15:44:33 -0400
Local: Wed, Sep 15 2010 3:44 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?
Is it worth creating a convenience method to "update metadata" since
this seems to be a frequent occurrence?

--
Chris Moyer

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Billenstein  
View profile  
 More options Sep 15 2010, 4:11 pm
From: Matt Billenstein <m...@vazor.com>
Date: Wed, 15 Sep 2010 13:11:49 -0700
Local: Wed, Sep 15 2010 4:11 pm
Subject: Re: [boto-users] Add cache-control header for object in S3?

On Wed, Sep 15, 2010 at 03:40:36PM -0400, Mitchell Garnaat wrote:
>    There is a "preserve_acl" boolean param to the copy method that will
>    handle this for you. *It basically does the same think you are doing
>    already but saves you a bit of work.

Ah, cool, thanks -- I was looking at the 1.9 docs online and overlooked
this...

m

--
Matt Billenstein
m...@vazor.com
http://www.vazor.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »