You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: b2sdk/bucket.py
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -495,6 +495,7 @@ def upload_bytes(
495
495
legal_hold: Optional[LegalHold] =None,
496
496
large_file_sha1: Optional[Sha1HexDigest] =None,
497
497
custom_upload_timestamp: Optional[int] =None,
498
+
cache_control: Optional[str] =None,
498
499
):
499
500
"""
500
501
Upload bytes in memory to a B2 file.
@@ -512,6 +513,7 @@ def upload_bytes(
512
513
:param bool legal_hold: legal hold setting
513
514
:param Sha1HexDigest,None large_file_sha1: SHA-1 hash of the result file or ``None`` if unknown
514
515
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
516
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
572
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
Upload an unbound file-like read-only object to a B2 file.
@@ -680,6 +687,7 @@ def upload_unbound_stream(
680
687
:param read_size: size of a single read operation performed on the ``read_only_object``
681
688
:param unused_buffer_timeout_seconds: amount of time that a buffer can be idle before returning error
682
689
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
690
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
683
691
:rtype: b2sdk.v2.FileVersion
684
692
"""
685
693
ifbuffers_count<=1:
@@ -719,6 +727,7 @@ def upload_unbound_stream(
719
727
max_queue_size=buffers_count-1,
720
728
large_file_sha1=large_file_sha1,
721
729
custom_upload_timestamp=custom_upload_timestamp,
730
+
cache_control=cache_control,
722
731
)
723
732
724
733
defupload(
@@ -734,6 +743,7 @@ def upload(
734
743
legal_hold: Optional[LegalHold] =None,
735
744
large_file_sha1: Optional[Sha1HexDigest] =None,
736
745
custom_upload_timestamp: Optional[int] =None,
746
+
cache_control: Optional[str] =None,
737
747
):
738
748
"""
739
749
Upload a file to B2, retrying as needed.
@@ -760,6 +770,7 @@ def upload(
760
770
:param bool legal_hold: legal hold setting
761
771
:param Sha1HexDigest,None large_file_sha1: SHA-1 hash of the result file or ``None`` if unknown
762
772
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
773
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
763
774
:rtype: b2sdk.v2.FileVersion
764
775
"""
765
776
returnself.create_file(
@@ -775,6 +786,7 @@ def upload(
775
786
legal_hold=legal_hold,
776
787
large_file_sha1=large_file_sha1,
777
788
custom_upload_timestamp=custom_upload_timestamp,
789
+
cache_control=cache_control,
778
790
)
779
791
780
792
defcreate_file(
@@ -793,6 +805,7 @@ def create_file(
793
805
max_part_size=None,
794
806
large_file_sha1=None,
795
807
custom_upload_timestamp: Optional[int] =None,
808
+
cache_control: Optional[str] =None,
796
809
):
797
810
"""
798
811
Creates a new file in this bucket using an iterable (list, tuple etc) of remote or local sources.
@@ -824,6 +837,7 @@ def create_file(
824
837
:param int max_part_size: upper limit of part size for the transfer planner, in bytes
825
838
:param Sha1HexDigest,None large_file_sha1: SHA-1 hash of the result file or ``None`` if unknown
826
839
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
840
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
827
841
"""
828
842
returnself._create_file(
829
843
self.api.services.emerger.emerge,
@@ -841,6 +855,7 @@ def create_file(
841
855
max_part_size=max_part_size,
842
856
large_file_sha1=large_file_sha1,
843
857
custom_upload_timestamp=custom_upload_timestamp,
858
+
cache_control=cache_control,
844
859
)
845
860
846
861
defcreate_file_stream(
@@ -859,6 +874,7 @@ def create_file_stream(
859
874
max_part_size=None,
860
875
large_file_sha1=None,
861
876
custom_upload_timestamp: Optional[int] =None,
877
+
cache_control: Optional[str] =None,
862
878
):
863
879
"""
864
880
Creates a new file in this bucket using a stream of multiple remote or local sources.
@@ -892,6 +908,7 @@ def create_file_stream(
892
908
:param int max_part_size: upper limit of part size for the transfer planner, in bytes
893
909
:param Sha1HexDigest,None large_file_sha1: SHA-1 hash of the result file or ``None`` if unknown
894
910
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
911
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
895
912
"""
896
913
returnself._create_file(
897
914
self.api.services.emerger.emerge_stream,
@@ -909,6 +926,7 @@ def create_file_stream(
909
926
max_part_size=max_part_size,
910
927
large_file_sha1=large_file_sha1,
911
928
custom_upload_timestamp=custom_upload_timestamp,
929
+
cache_control=cache_control,
912
930
)
913
931
914
932
def_create_file(
@@ -966,6 +984,7 @@ def concatenate(
966
984
max_part_size=None,
967
985
large_file_sha1=None,
968
986
custom_upload_timestamp: Optional[int] =None,
987
+
cache_control: Optional[str] =None,
969
988
):
970
989
"""
971
990
Creates a new file in this bucket by concatenating multiple remote or local sources.
@@ -994,6 +1013,7 @@ def concatenate(
994
1013
:param int max_part_size: upper limit of part size for the transfer planner, in bytes
995
1014
:param Sha1HexDigest,None large_file_sha1: SHA-1 hash of the result file or ``None`` if unknown
996
1015
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
1016
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
Creates a new file in this bucket by concatenating stream of multiple remote or local sources.
@@ -1050,6 +1072,7 @@ def concatenate_stream(
1050
1072
:param bool legal_hold: legal hold setting
1051
1073
:param Sha1HexDigest,None large_file_sha1: SHA-1 hash of the result file or ``None`` if unknown
1052
1074
:param int,None custom_upload_timestamp: override object creation date, expressed as a number of milliseconds since epoch
1075
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
:param str,None source_content_type: source file's content type, useful when copying files with SSE-C
1132
1157
:param b2sdk.v2.FileRetentionSetting file_retention: file retention setting for the new file.
1133
1158
:param bool legal_hold: legal hold setting for the new file.
1159
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
1134
1160
:param int min_part_size: lower limit of part size for the transfer planner, in bytes
1135
1161
:param int max_part_size: upper limit of part size for the transfer planner, in bytes
:param b2sdk.v2.LegalHold legal_hold: legal hold setting
101
+
:param str,None cache_control: an optional cache control setting. Syntax based on the section 14.9 of RFC 2616. Example string value: 'public, max-age=86400, s-maxage=3600, no-transform'.
0 commit comments