Skip to content

Commit

Permalink
Fix unsafe yaml load and small refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
  • Loading branch information
Adam.Dybbroe committed May 4, 2023
1 parent 3ab365e commit b752d38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pytroll_collectors/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
"""Handling the yaml configurations."""

import yaml
from yaml import UnsafeLoader


def read_config(config_filepath):
"""Read and extract config information."""
with open(config_filepath, 'r') as fp_:
config = yaml.load(fp_, Loader=UnsafeLoader)
config = yaml.safe_load(fp_)

return config
8 changes: 2 additions & 6 deletions pytroll_collectors/scisys.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,8 @@ def receive_from_zmq(config_filename,

config = read_config(config_filename)

excluded_platforms = config['excluded_satellites']
host = config['host']
port = config['port']

sock = GMCSubscriber(host, port)
msg_rec = MessageReceiver(host, excluded_platforms,
sock = GMCSubscriber(config['host'], config['port'])
msg_rec = MessageReceiver(config['host'], config['excluded_platforms'],
target_server, ftp_prefix)

with Publish("receiver", port=publish_port,
Expand Down

0 comments on commit b752d38

Please sign in to comment.