Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expire, content_* args #216

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
* Add `--expires`, `--content-disposition`, `--content-encoding`, `--content-language` options to subcommands `upload-file`, `upload-unbound-stream`, `copy-file-by-id`

### Fixed
* `--quiet` now will implicitly set `--noProgress` option as well
Expand Down
40 changes: 40 additions & 0 deletions b2/console_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,21 @@ def _setup_parser(cls, parser):
parser.add_argument('--metadataDirective', default=None, help=argparse.SUPPRESS)
parser.add_argument('--contentType')
parser.add_argument('--range', type=parse_range)
parser.add_argument(
'--cache-control', help='Add Cache-Control header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--content-disposition', help='Add Content-Disposition header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--content-language', help='Add Content-Language header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--content-encoding', help='Add Content-Encoding header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--expires', help='Add Expires header' # TODO(vbaltrusaitis-reef): better description
)

info_group = parser.add_mutually_exclusive_group()

Expand Down Expand Up @@ -1078,6 +1093,11 @@ def run(self, args):
file_retention=file_retention,
source_file_info=source_file_info,
source_content_type=source_content_type,
cache_control=args.cache_control,
expires=args.expires,
content_disposition=args.content_disposition,
content_encoding=args.content_encoding,
content_language=args.content_language,
)
self._print_json(file_version)
return 0
Expand Down Expand Up @@ -2791,6 +2811,18 @@ def _setup_parser(cls, parser):
'--sha1', help="SHA-1 of the data being uploaded for verifying file integrity"
)
parser.add_argument('--cache-control', default=None)
parser.add_argument(
'--content-disposition', help='Add Content-Disposition header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--content-language', help='Add Content-Language header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--content-encoding', help='Add Content-Encoding header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--expires', help='Add Expires header' # TODO(vbaltrusaitis-reef): better description
)
parser.add_argument(
'--info',
action='append',
Expand Down Expand Up @@ -2842,12 +2874,20 @@ def get_execute_kwargs(self, args) -> dict:
self.api.get_bucket_by_name(args.bucketName),
"cache_control":
args.cache_control,
"content_disposition":
args.content_disposition,
"content_encoding":
args.content_encoding,
"content_language":
args.content_language,
"content_type":
args.contentType,
"custom_upload_timestamp":
args.custom_upload_timestamp,
"encryption":
self._get_destination_sse_setting(args),
"expires":
args.expires,
"file_info":
file_infos,
"file_name":
Expand Down
Loading