|
ocssw
V2022
|
spacetrack_tles.py File Reference
Go to the source code of this file.
Namespaces | |
| spacetrack_tles | |
Variables | |
| dictionary | norad |
| parser | |
| action | |
| version | |
| nargs | |
| help | |
| type | |
| choices | |
| str | |
| default | |
| None | |
| int | |
| False | |
| args = parser.parse_args() | |
| level | |
| identity = args.username | |
| password = args.password | |
| netrc = os.path.join(os.environ['HOME'],'.netrc') | |
| parts = line.split() | |
| dictionary | credentials = {'identity':identity,'password':password} |
| baseTLEdir = args.directory | |
| tleIDs = None | |
| string | baseurl = "https://www.space-track.org" |
| string | loginurl = '/'.join([baseurl, "ajaxauth","login"]) |
| string | tleurl = '/'.join([baseurl,"basicspacedata","query","class","tle_latest","ORDINAL","1","NORAD_CAT_ID",tleIDs,"format","tle"]) |
| stConn = requests.Session() | |
| dictionary | tlehash = {} |
| req = stConn.post(loginurl, data=credentials) | |
| tlereq = stConn.get(tleurl) | |
| tleID = int(parts[1].strip('U')) | |
| string | bird = 'NORAD_' + str(tleID) |
| dictionary | tle = tlehash[tleID] |
| dictionary | tleDate = tle[0].split()[3] |
| year = str(int(tleDate[0:2]) + 2000) | |
| dictionary | doy = tleDate[2:5] |
| tleFile = os.path.join(baseTLEdir,bird+doy+year+".dat") | |
| tceFile = os.path.join(baseTLEdir,bird+".tce") | |
| ext | |


