Skip to content

Commit f21d8dd

Browse files
authored
Merge pull request #153 from DevoInc/PAR-14428
fix: binary formats requires output parameter
2 parents c88dfd9 + 1a13637 commit f21d8dd

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [4.0.3] - 2022-09-12
8+
### Fix
9+
* Added a constraint in client parameters so binary formats like, `msgpack` and `xls`, cannot be invoked without `output`parameter
10+
11+
712
## [4.0.2] - 2022-09-01
813
### Added
9-
* Add a new command-line option for escaping double quotes with `-eq` or `--escape_quotes`.
10-
* Add a check and shows a warning if the file contains double quotes and the option `-eq` is not used.
11-
* Add a new command-line option in tests for testing just one module with `-m <module_name>` or `--module <module_name>`.
14+
* Add a new command-line option for escaping double quotes with `-eq` or `--escape_quotes`
15+
* Add a check and shows a warning if the file contains double quotes and the option `-eq` is not used
16+
* Add a new command-line option in tests for testing just one module with `-m <module_name>` or `--module <module_name>`
17+
1218
## [4.0.1] - 2022-08-26
1319
### Added
1420
* Create GitHub action to publish package in PyPI

devo/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__description__ = 'Devo Python Library.'
22
__url__ = 'http://www.devo.com'
3-
__version__ = "4.0.2"
3+
__version__ = "4.0.3"
44
__author__ = 'Devo'
55
__author_email__ = 'support@devo.com'
66
__license__ = 'MIT'

devo/api/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
"no_auth": "Client dont have key&secret or auth token/jwt",
3333
"no_endpoint": "Endpoint 'address' not found",
3434
"to_but_no_from": "If you use end dates for the query 'to' it is "
35-
"necessary to use start date 'from'"
35+
"necessary to use start date 'from'",
36+
"binary_format_requires_output": "Binary format like `msgpack` and `xls` "
37+
"requires output parameter"
3638
}
3739

3840
DEFAULT_KEEPALIVE_TOKEN = '\n'

devo/api/scripts/client_cli.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def cli(version):
4848
@click.option('--output', help='File path to store query response if not want '
4949
'stdout')
5050
@click.option('--response', '-r', default="json/simple/compact",
51-
help='The output format. Default is json/simple/compact')
51+
help='The output format. Default is json/simple/compact',
52+
type=click.Choice(['json', 'json/compact', 'json/simple',
53+
'json/simple/compact', 'msgpack', 'csv',
54+
'tsv', 'xls']))
5255
@click.option('--from',
5356
help='From date. For valid formats see API README.'
5457
' Default if now - 1 hour')
@@ -89,6 +92,14 @@ def query(**kwargs):
8992
else:
9093
dates = None
9194

95+
if "response" in config.keys():
96+
if config["response"] in ["msgpack", "xls"]:
97+
if "output" not in config.keys():
98+
print_error(ERROR_MSGS['binary_format_requires_output'],
99+
show_help=True)
100+
exit()
101+
102+
92103
reponse = api.query(query=config['query'], dates=dates)
93104

94105
process_response(reponse, config)

0 commit comments

Comments
 (0)