flask-storage 2.0.2.dev1__py3-none-any.whl → 2.0.3.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,10 @@ class S3Backend(BaseBackend):
46
46
  - `region`: The region to work on.
47
47
  - `access_key`: The AWS credential access key
48
48
  - `secret_key`: The AWS credential secret key
49
+
50
+ and optionally:
51
+
52
+ - `create_bucket`: Create the bucket at startup if it does not exist
49
53
  """
50
54
 
51
55
  _S3_OBJECT_OPTION_MAP = {
@@ -70,8 +74,12 @@ class S3Backend(BaseBackend):
70
74
  self.client = self.s3.meta.client
71
75
  self.bucket = self.s3.Bucket(config.get("bucket_name") or name)
72
76
 
73
- if not self.bucket.creation_date:
74
- # The bucket does not exist, create it
77
+ # Opt-in because checking for the bucket costs a ListBuckets request
78
+ # (boto3 has no way to load a single bucket's attributes), made by every
79
+ # process at startup: an unavailable S3 then prevents the application
80
+ # from starting at all, even though it does not need S3 until it reads
81
+ # or writes a file.
82
+ if config.get("create_bucket") and not self.bucket.creation_date:
75
83
  self.bucket.create()
76
84
 
77
85
  def exists(self, filename):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flask-storage
3
- Version: 2.0.2.dev1
3
+ Version: 2.0.3.dev1
4
4
  Summary: Simple and easy file storages for Flask
5
5
  Author-email: Etalab <etalab@data.gouv.fr>
6
6
  Project-URL: Home, https://github.com/etalab/flask-storage
@@ -9,10 +9,10 @@ flask_storage/views.py,sha256=YngzSXuxwiT-GQFLNWrXk0SrPcyKmbrDCOubMt3Wo9g,325
9
9
  flask_storage/backends/__init__.py,sha256=thajBIF5Ok5zAiLEZmYBHwTxjmtD6_-Y1kXnNYQH5ws,4051
10
10
  flask_storage/backends/local.py,sha256=Z0hgBtSr5yRbllGLRlqXpTHSNJgTJLTlxl0harEmAXY,4245
11
11
  flask_storage/backends/mock.py,sha256=0-b6SfzIuVO5Uu8BlSz1uNNALyBGNHePz5o79Ef1aOw,185
12
- flask_storage/backends/s3.py,sha256=z5L7juDiwMLOglKQvS7fqIVDkeZZcgwcGzZT9hDgE70,9626
13
- flask_storage-2.0.2.dev1.dist-info/licenses/LICENSE,sha256=Jsa1CKm-fF0guY0ht3reKgv2D3ReoCjNVX0IPtreqSE,1081
14
- flask_storage-2.0.2.dev1.dist-info/METADATA,sha256=FINPn-v0HfDQLHR-ApOkAQYdEg_3Jqnv_MD7HIuRbIU,1312
15
- flask_storage-2.0.2.dev1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
16
- flask_storage-2.0.2.dev1.dist-info/entry_points.txt,sha256=hX7fv5H16y_4DLa-TJKZrdSqcddfRo1AEFSN3oH0cHs,156
17
- flask_storage-2.0.2.dev1.dist-info/top_level.txt,sha256=dewU5rlVVfXSOtwXxhCTSujH1TX9-8SXFK9L67Lux3U,14
18
- flask_storage-2.0.2.dev1.dist-info/RECORD,,
12
+ flask_storage/backends/s3.py,sha256=CV8rwaFSUJOk5pTz4pOv_z679FZD1nuJ9NC9cJswK44,10045
13
+ flask_storage-2.0.3.dev1.dist-info/licenses/LICENSE,sha256=Jsa1CKm-fF0guY0ht3reKgv2D3ReoCjNVX0IPtreqSE,1081
14
+ flask_storage-2.0.3.dev1.dist-info/METADATA,sha256=0sy_JYvr3Zk3yeiIU_lFjGT54hPm7ikz-NV5A8UPTeE,1312
15
+ flask_storage-2.0.3.dev1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
16
+ flask_storage-2.0.3.dev1.dist-info/entry_points.txt,sha256=hX7fv5H16y_4DLa-TJKZrdSqcddfRo1AEFSN3oH0cHs,156
17
+ flask_storage-2.0.3.dev1.dist-info/top_level.txt,sha256=dewU5rlVVfXSOtwXxhCTSujH1TX9-8SXFK9L67Lux3U,14
18
+ flask_storage-2.0.3.dev1.dist-info/RECORD,,