コード例 #1
0
 def canonical_resource(self):
     res = "/"
     if self.bucket:
         res += aws_urlquote(self.bucket)
     if self.key is not None:
         res += "/%s" % aws_urlquote(self.key)
     if self.subresource:
         res += "?%s" % aws_urlquote(self.subresource)
     return res
コード例 #2
0
 def url(self, base_url, arg_sep="&"):
     url = base_url + "/"
     if self.key:
         url += aws_urlquote(self.key)
     if self.subresource or self.args:
         ps = []
         if self.subresource:
             ps.append(self.subresource)
         if self.args:
             args = self.args
             if hasattr(args, "iteritems"):
                 args = args.iteritems()
             args = ((quote_plus(k), quote_plus(v)) for (k, v) in args)
             args = arg_sep.join("%s=%s" % i for i in args)
             ps.append(args)
         url += "?" + "&".join(ps)
     return url
コード例 #3
0
 def __init__(self,
              name=None,
              access_key=None,
              secret_key=None,
              base_url=None,
              timeout=None,
              secure=False):
     scheme = ("http", "https")[int(bool(secure))]
     if not base_url:
         base_url = "%s://%s" % (scheme, amazon_s3_domain)
         if name:
             base_url += "/%s" % aws_urlquote(name)
     elif secure is not None:
         if not base_url.startswith(scheme + "://"):
             raise ValueError("secure=%r, url must use %s" %
                              (secure, scheme))
     self.opener = self.build_opener()
     self.name = name
     self.access_key = access_key
     self.secret_key = secret_key
     self.base_url = base_url
     self.timeout = timeout
コード例 #4
0
ファイル: test_bucket.py プロジェクト: crosspop/simples3
 def test_aws_urlquote_funky(self):
     if hasattr(str, "decode"):
         val = "/bucket/\xc3\xa5der".decode("utf-8")
     else:
         val = "/bucket/\xe5der"
     eq_(aws_urlquote(val), "/bucket/%C3%A5der")
コード例 #5
0
ファイル: test_bucket.py プロジェクト: kimdwkimdw/simples3
 def test_aws_urlquote_funky(self):
     if hasattr(str, "decode"):
         val = "/bucket/\xc3\xa5der".decode("utf-8")
     else:
         val = "/bucket/\xe5der"
     eq_(aws_urlquote(val), "/bucket/%C3%A5der")
コード例 #6
0
 def __init__(self, server_name=None):
     self._check_filesystem_errors()
     self.name = 'AmazonS3'
     self.baseurl = self.S3_DOMAIN + aws_urlquote(self.S3_BUCKET)
     BaseStorage.__init__(self)