diff --git a/neoexchange/core/management/commands/fetch_arecibo_targets.py b/neoexchange/core/management/commands/fetch_arecibo_targets.py index 651d11636..c3d0ad3d5 100644 --- a/neoexchange/core/management/commands/fetch_arecibo_targets.py +++ b/neoexchange/core/management/commands/fetch_arecibo_targets.py @@ -27,9 +27,12 @@ class Command(BaseCommand): def handle(self, *args, **options): self.stdout.write("==== Fetching Arecibo targets %s ====" % (datetime.now().strftime('%Y-%m-%d %H:%M'))) radar_targets = fetch_arecibo_targets() - for obj_id in radar_targets: - self.stdout.write("Reading Arecibo target %s" % obj_id) - update_MPC_orbit(obj_id, origin='A') - # Wait between 10 and 20 seconds - delay = random_delay(10, 20) - self.stdout.write("Slept for %d seconds" % delay) + if radar_targets is not None: + for obj_id in radar_targets: + self.stdout.write("Reading Arecibo target %s" % obj_id) + update_MPC_orbit(obj_id, origin='A') + # Wait between 10 and 20 seconds + delay = random_delay(10, 20) + self.stdout.write("Slept for %d seconds" % delay) + else: + self.stdout.write("Found no Arecibo targets to update") diff --git a/neoexchange/core/management/commands/fetch_goldstone_targets.py b/neoexchange/core/management/commands/fetch_goldstone_targets.py index 35d7c801f..301790e31 100644 --- a/neoexchange/core/management/commands/fetch_goldstone_targets.py +++ b/neoexchange/core/management/commands/fetch_goldstone_targets.py @@ -28,9 +28,12 @@ class Command(BaseCommand): def handle(self, *args, **options): self.stdout.write("==== Fetching Goldstone targets %s ====" % (datetime.now().strftime('%Y-%m-%d %H:%M'))) radar_targets = fetch_goldstone_targets() - for obj_id in radar_targets: - self.stdout.write("Reading Goldstone target %s" % obj_id) - update_MPC_orbit(obj_id, origin='G') - # Wait between 10 and 20 seconds - delay = random_delay(10, 20) - self.stdout.write("Slept for %d seconds" % delay) + if radar_targets is not None: + for obj_id in radar_targets: + self.stdout.write("Reading Goldstone target %s" % obj_id) + update_MPC_orbit(obj_id, origin='G') + # Wait between 10 and 20 seconds + delay = random_delay(10, 20) + self.stdout.write("Slept for %d seconds" % delay) + else: + self.stdout.write("Found no Goldstone targets to update")