|
13 | 13 | # |
14 | 14 | import os |
15 | 15 | import string |
16 | | -import urllib |
| 16 | +import time |
| 17 | +import urllib.request |
17 | 18 |
|
18 | 19 | # Satellite groups |
19 | 20 | groups = { |
|
22 | 23 | "galileo" : "Galileo Nav.", |
23 | 24 | "glo-ops" : "Glonass Operational", |
24 | 25 | "gps-ops" : "GPS Operational", |
25 | | - "iridium" : "Iridium", |
26 | 26 | "iridium-NEXT" : "Iridium NEXT", |
27 | 27 | "molniya" : "Molniya", |
28 | 28 | "noaa" : "NOAA", |
|
89 | 89 | "43017" : "AO-91" |
90 | 90 | } |
91 | 91 |
|
92 | | -urlprefix = "http://celestrak.com/NORAD/elements/" |
| 92 | +urlprefix = "https://celestrak.org/NORAD/elements/gp.php?GROUP=" |
| 93 | +urlsuffix = "&FORMAT=tle" |
93 | 94 |
|
94 | | - |
95 | | -for group, name in groups.iteritems(): |
96 | | - webfile = urlprefix + group + ".txt" |
| 95 | +for group, name in groups.items(): |
| 96 | + webfile = urlprefix + group + urlsuffix |
97 | 97 | localfile = "./in/" + group + ".txt" |
98 | | - print "Fetching " + webfile + " => " + localfile |
99 | | - urllib.urlretrieve (webfile, localfile) |
| 98 | + print("Fetching " + webfile + " => " + localfile) |
| 99 | + urllib.request.urlretrieve (webfile, localfile) |
| 100 | + time.sleep(30) |
100 | 101 |
|
101 | 102 | ### CHK ### |
102 | 103 |
|
103 | 104 | # For each input file |
104 | | -for group, name in groups.iteritems(): |
| 105 | +for group, name in groups.items(): |
105 | 106 |
|
106 | | - print name+':' |
| 107 | + print(name+':') |
107 | 108 |
|
108 | 109 | # open TLE file for reading |
109 | 110 | tlefile = open('./in/'+group+'.txt', 'r') |
|
124 | 125 |
|
125 | 126 | # catalog number; strip leading zeroes |
126 | 127 | catnum = line2[2:7].lstrip('0') |
127 | | - print " ... "+catnum |
| 128 | + print(" ... " + catnum) |
128 | 129 |
|
129 | 130 | # add satellite to category |
130 | 131 | catfile.write(catnum+'\n') |
|
0 commit comments