tle module

A script that downloads TLE files.

This file exists as a standalone script that is run separate from the rest of the kpno project. The script downloads every TLE from http://www.celestrak.com/NORAD/elements/. Upon download the TLE files are joined into one large TLE that is then compressed using gzip.

class tle.TLEHTMLParser[source]

Bases: html.parser.HTMLParser

Parser for finding TLE files.

data

Extracted data from the TLE website HTML.

Type:list
clear_data()[source]

Clear the data list of this parser instance.

handle_starttag(tag, attrs)[source]

Extract TLE links from the HTML start tag.

Parameters:
  • tag (str) – The start tag
  • attrs (list) – The attributes attached to the corresponding tag.
tle.download()[source]

Download a day’s TLE files.

Notes

On the website TLE files are separated by category. When downloaded, this method will combine them into one TLE file that is named with the date on which the TLE was downloaded. The TLE txt file is then compressed with gzip. The final file will be named date.txt.gz

The TLE files are located at http://www.celestrak.com/NORAD/elements/.

tle.download_url(link)[source]

Read the data at a url.

Parameters:link (str) – The link to access and download data from.
Returns:A requests.Response object containing data on success, or None on failure.
Return type:requests.Response or None
tle.run_and_download()[source]

Runs the script and downloads the images.

See also

download()
Download the day’s TLE file.

Notes

This method exectures the code flow of the script. Once a TLE file is downloaded the method will sleep until 12:30 the next day and repeat the process.