adding client_method param for get auth link methods.
1 files changed, 7 insertions(+), 5 deletions(-)

M webutils/aws/secures3.py
M webutils/aws/secures3.py +7 -5
@@ 54,8 54,8 @@ class SecureS3(object):
 
         return (bucket, filename, s.scheme)
 
-    def get_auth_link(self, bucket, filename, scheme='http',
-                      expires=300, timestamp=None):
+    def get_auth_link(self, bucket, filename, scheme='http', expires=300,
+                      timestamp=None, client_method='get_object'):
         ''' Return a secure S3 link with an expiration on the download.
 
             key: S3 Access Key (login)

          
@@ 64,6 64,7 @@ class SecureS3(object):
             filename: file path
             expires: Seconds from NOW the link expires
             timestamp: Epoch timestamp. If present, "expires" will not be used.
+            client_method: The client method to generate the presigned url
         '''
         filename = quote_plus(filename)
         filename = filename.replace('%2F', '/')

          
@@ 79,13 80,13 @@ class SecureS3(object):
             aws_secret_access_key=self.secret_key,
         )
         url = s3_client.generate_presigned_url(
-            ClientMethod='get_object',
+            ClientMethod=client_method,
             Params={'Bucket': bucket, 'Key': filename},
             ExpiresIn=expires_in,
         )
         return url
 
-    def get_easy_auth_link(self, url, expires=600):
+    def get_easy_auth_link(self, url, expires=600, client_method='get_object'):
         ''' url should be the full URL to the secure file hosted on S3.
             examples:
             http://s3.amazonaws.com/your-bucket/yourfile.zip

          
@@ 97,4 98,5 @@ class SecureS3(object):
         except ValueError:
             return None
 
-        return self.get_auth_link(*data[:2], scheme=data[2], expires=expires)
+        return self.get_auth_link(*data[:2], scheme=data[2], expires=expires,
+                                  client_method=client_method)