1
0
Fork 0

base/tasks.py: Use python23-compatible print method

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
merge-requests/787/head
Fabian P. Schmidt 2019-11-15 00:03:31 +01:00
parent 5e605af275
commit 2f7e73f2c8
1 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,5 @@
from __future__ import print_function
import json
import os
import urllib2
@ -27,7 +29,7 @@ def update_all_tle():
manual_tle=True, norad_follow_id__isnull=True
).prefetch_related(Prefetch('tles', queryset=latest_tle_queryset, to_attr='tle'))
print "==Fetching TLEs=="
print("==Fetching TLEs==")
for obj in satellites:
norad_id = obj.norad_cat_id
@ -38,16 +40,16 @@ def update_all_tle():
# Fetch latest satellite TLE
tle = fetch_tle_from_celestrak(norad_id)
except LookupError:
print '{} - {}: TLE not found [error]'.format(obj.name, norad_id)
print('{} - {}: TLE not found [error]'.format(obj.name, norad_id))
continue
if obj.tle and obj.tle[0].tle1 == tle[1]:
# Stored TLE is already the latest available for this satellite
print '{} - {}: TLE already exists [defer]'.format(obj.name, norad_id)
print('{} - {}: TLE already exists [defer]'.format(obj.name, norad_id))
continue
Tle.objects.create(tle0=tle[0], tle1=tle[1], tle2=tle[2], satellite=obj)
print '{} - {}: new TLE found [updated]'.format(obj.name, norad_id)
print('{} - {}: new TLE found [updated]'.format(obj.name, norad_id))
@APP.task(ignore_result=True)