Skip to content

Commit c716be9

Browse files
authored
Use click methods for file handling (#110)
1 parent b359d24 commit c716be9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

alertaclient/commands/cmd_send.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ def cli(obj, resource, event, environment, severity, correlate, service, group,
2727
client = obj['client']
2828

2929
# read raw data from file or stdin
30-
if raw_data and raw_data.startswith('@'):
30+
if raw_data and raw_data.startswith('@') or raw_data == '-':
3131
raw_data_file = raw_data.lstrip('@')
32-
with open(raw_data_file, 'r') as f:
32+
with click.open_file(raw_data_file, 'r') as f:
3333
raw_data = f.read()
34-
elif raw_data == '-':
35-
raw_data = sys.stdin.read()
3634

3735
try:
3836
id, alert, message = client.send_alert(

0 commit comments

Comments
 (0)