Astro-SpaceTrack

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    https://blogs.perl.org/users/mikko_koivunalho/2025/11/github-and-the-perl-license.html
    for the how-to.

    Deprecate mccants( 'quicksat' ) since he dropped the underlying file
    about December 15 2025.

0.171		2025-10-06	T. R. Wyant
    Deprecate mccants() arguments 'mcnames' and 'vsnames'. The
    underlying files have been removed from the web site. This is an
    accellerated deprecation. This commit causes the arguments to warn
    on every use in addition to the 404 error caused by the removal. Six
    months from the release of Astro-SpaceTrack 0.171 these arguments
    will be made into a fatal error.

0.170		2025-09-18	T. R. Wyant
    All iridium functionality now warns (at least) on all uses.

    Deprecate amsat(), since they have gone to "humans-only".

    Remove the 'direct' attribute.

Changes  view on Meta::CPAN

    Add 'css' to Celestrak supplemental data.

0.167		2024-09-15	T. R. Wyant
    Add celestrak catalog 'eutelsat'.

    Further deprecate Iridium status, 'direct' attribute.

0.166		2024-06-16	T. R. Wyant
    Correct celestrak_supplemental() status when an unknown catalog is
    specified. The previous was the oxymoronic '400 OK'. The intended
    (and now implemented) is 404 with a custom error message.

    Add back Celestrak SES supplemental data.

    Add Project Kuiper to Celestrak supplemental data.

0.165		2024-05-04	T. R. Wyant
    Space Track options in celestrak() are now fatal.

    Mike McCants removes his RCS data file. The corresponding mccants()
    catalog is documented as 404, and to be removed 2024-11-01 unless it
    shows back up in the interim. The corresponding test is now TODO.

    Track changes in Kelso data set names. He renamed the data sets for
    the Chinese and Russian ASAT test debris. The old names are retained
    as synonyms. The data supporting the synonyms etc got refactired
    from the test into Astro::SpaceTrack so I could display the notes in
    names->( 'celestrak' )

    Kelso dropped Iridium status and SES supplemental data April 26
    2024.

Changes  view on Meta::CPAN


0.132		2019-08-05	T. R. Wyant
    Update canned status table for decay of

    - Iridium 61

0.131		2019-07-20	T. R. Wyant
    Fix broken POD links, and add test to ensure they stay fixed.
    
    Further deprecate McCants' Iridium status. This is really moot,
    since as of July 10 2019 his Iridium status page is 404. It was last
    seen by me June 9 2019.

    Correct the test suite's check for whether Mike McCants' web site is
    live.

0.130		2019-06-05	T. R. Wyant
    Add Celestrak Starlink catalog.

0.129		2019-05-19	T. R. Wyant
    Update canned status table for decay of

Changes  view on Meta::CPAN

  Add new spacetrack() catalogs bright_geosynchronous, human_spaceflight
    and well_tracked_objects. The first two correspond to Space Track
    curated queries; the last does not, but is based on their Face Book
    entry for December 3 2014, and represents objects that can not be
    assigned to a country or launch site.

  Fix option hash validation warning in spacetrack(). This affected
    catalog 'payload'.

  Fix exception in names() when an unsupported argument is passed. The
    desired functionality was to return a 404 error, which is now
    implememted and documented.

  Change verify_hostname default back to true, since it appears that
    Perl is accepting Mike McCants' Cert again.

0.088		2014-08-31	T. R. Wyant
  Properly apply Space Track default fetch options when the options were
    passed to a Space Track search method in a hash reference, rather
    than command-line style.

Changes  view on Meta::CPAN

        address.

    Require Test::More 0.88 for testing.

    Remove the Space Shuttle option from the SpaceTrackTk 'Human Space
        Flight' dialog.

0.054		2011-07-21	T. R. Wyant
    With the end of the U.S. Space Shuttle program, deprecate the
        celestrak() 'sts' catalog and the spaceflight() 'SHUTTLE'
	argument. The latter now does nothing, so we will not get 404
	errors when the web page goes away.

0.053		2011-07-04	T. R. Wyant
    Correct the URL for Mike McCants' Iridium status web page.

0.052		2011-04-12	T. R. Wyant
    Add attribute scheme_space_track_attribute, defaulting to 'https'.
	Also added LWP::Protocol::https as a dependency. Both in
	response to USSTRATCOM going to a secure server some time in the
	last 24 hours. Thanks to Thomas Wehr for diagnosing this, and

Changes  view on Meta::CPAN

	Build.PL, as a way to handle apparant ActiveState build
	failure because both they and I were running pl2bat.bat.

    Enhance ExtUtils::MakeMaker version detection in Makefile.PL,
	since ActiveState is apparantly deploying a Perl 5.10
	with a development version of that module.

0.030		2007-10-24	T. R. Wyant
    Add Celestrak 'sts' data set name to catalog.

    Different error text for data sets in catalog but 404 and data sets
	not in catalog and 404.

0.029		2007-10-13	T. R. Wyant
    Add Celestrak galileo and sbas data set names to catalog.

    Document celestrak data set names, or at least how to get them and
	in general how they are formed.

    Trap and error out on invalid spacetrack() data set numbers.

    Add data set numbers to spacetrack() help.

inc/Mock/LWP/UserAgent.pm  view on Meta::CPAN

	my ( $self, $url ) = @_;
	return $self->request( HTTP::Request->new( PUT => $url ) );
    };

    *LWP::UserAgent::request = sub {
	my ( $self, $rqst ) = @_;
	my $method = $rqst->method();
	my $url = $rqst->url();

	my $data = $self->{ +__PACKAGE__ }{data}{$url}{$method}
	    or return _fail( $rqst, 404, "$method $url not found" );
	my $resp = HTTP::Response->new( @{ $data } );

	$resp->request( $rqst );
	if ( my $jar = $self->cookie_jar() ) {
	    $jar->extract_cookies( $resp );
	}
	return $resp;
    };
}

inc/Mock/LWP/UserAgent.pm  view on Meta::CPAN

L<LWP::UserAgent|LWP::UserAgent>.

The canned response file is a JSON representaton of a hash keyed by URL
and, within URL, by HTTP method (C<GET>, C<POST>, and so on). The actual
responses are four-element arrays that constitute the arguments to
C<< HTTP::Response->new() >>.

Assuming the given file can be opened, read, and decoded, any request
will be satisfied by an L<HTTP::Response|HTTP::Response> object
generated from the data in the file. If the URL and method do not appear
in the file, a 404 response is generated.

=head1 METHODS

This class supports the following public method:

=head2 install_mock

This static method sets C<$Astro::SpaceTrack::SPACETRACK_DELAY_SECONDS>
to zero. It also hot-patches the following
L<LWP::UserAgent|LWP::UserAgent> methods:

inc/Mock/LWP/UserAgent.pm  view on Meta::CPAN

This method returns the response for a PUT request on the given URL.
The heavy lifting is done by L<request()|/request>.

=head3 request

 my $resp = $ua->request( $rqst );

This method returns the response for the given
L<HTTP::Request|HTTP::Request> object from the data loaded by
L<__load_data()|/__load_data>. If the given URL and method are not
found, the response is a 404 error.

=head1 ATTRIBUTES

This class has no public attributes.

=head1 SUBROUTINES

This class also has a couple old-school subroutines to manage its data.
These are unsupported, and documented solely for the convenience of the
author.

inc/My/Module/Test.pm  view on Meta::CPAN

package. The author reserves the right to change or revoke anything here
without notice.

=head1 SUBROUTINES

This package exports the following subroutines, all by default.

=head2 is_error

 is_error $st, fubar => 42,
     404,
     'Make sure $st->fubar( 42 ) returns a 404';

This subroutine executes the given method and tests its result code for
numeric equality to the given code.  The method is assumed to return an
HTTP::Response object. The arguments are:

  - The method's invocant
  - The method's name
  - Zero or more arguments
  - The expected HTTP status code
  - The test name

=head2 is_error_or_skip

 is_error $st, fubar => 42,
     404,
     'Make sure $st->fubar( 42 ) returns a 404';

This subroutine is like C<is_error(), but if the returned status is 500,
the test is skipped.

=head2 is_not_success

 is_not_success $st, fubar => 42,
     'Make sure $st->fubar( 42 ) fails';

This subroutine executes the given method and tests its result for

lib/Astro/SpaceTrack.pm  view on Meta::CPAN

Space Track no longer provides.

=item The C<OBJECT_NUMBER> datum is missing from JSON data.

This datum is no longer provided by Space Track, and I am not minded to
fudge it in. C<NORAD_CAT_ID> has the same value.

=item Favorites do not work

In the previous release C<spacetrack()> would fetch canned favorites
curated by Space Track. As of January 21 2026 these are 404. If I find
these data sets I will restore them. Favorites can still be retrieved
via the C<favorite()> method.

=back

=head1 LEGAL NOTICE

The following two paragraphs are quoted from the Space Track web site.

Due to existing National Security Restrictions pertaining to access of

lib/Astro/SpaceTrack.pm  view on Meta::CPAN

	},
	# Removed 2025-12-15 or thereabouts
	quicksat	=> {
	    name	=> 'Quicksat-format magnitude file',
	    member	=> undef,	# qs.mag
	    spacetrack_type	=> 'quicksat',
	    url		=> 'https://www.mmccants.org/programs/qsmag.zip',
	},
	# Removed 2024-12-29.
	#rcs	=> {
	#    name	=> 'McCants-format RCS data (404 2024-04-27)',
	#    member	=> undef,	# rcs
	#    spacetrack_type	=> 'rcs.mccants',
	#    url		=> 'https://www.mmccants.org/catalogs/rcs.zip',
	#},
	vsnames	=> {
	    name	=> 'Molczan-format magnitude file (visual only)',
	    member	=> undef,	# vsnames
	    spacetrack_type	=> 'molczan',
	    url		=> 'https://www.mmccants.org/tles/vsnames.zip',
	},

lib/Astro/SpaceTrack.pm  view on Meta::CPAN

}

=for html <a name="names"></a>

=item $resp = $st->names (source)

This method retrieves the names of the catalogs for the given source,
either C<'celestrak'>, C<'celestrak_supplemental'>, C<'iridium_status'>,
C<'mccants'>, or C<'spacetrack'>, in the content of
the given HTTP::Response object. If the argument is not one of the
supported values, the C<$resp> object represents a 404 (Not found)
error.

In list context, you also get a reference to a list of two-element
lists; each inner list contains the description and the catalog name, in
that order (suitable for inserting into a Tk Optionmenu). If the
argument is not one of the supported values, the second return will be
C<undef>.

No Space Track username and password are required to use this method,
since all it is doing is returning data kept by this module.

lib/Astro/SpaceTrack.pm  view on Meta::CPAN

  * visible         Visible satellites
  * special         Special satellites
  * bright_geosynchronous
                    Bright Geosynchronous satellites
  * human_spaceflight
                    Human Spaceflight
    well_tracked_objects
                    Well-Tracked Objects not associated
		    with a specific launch

The starred items are 404 as of 2026-01-19. They are deprecated and will
be removed.

The following option is supported:

 -json
   specifies the TLE be returned in JSON format

Options may be specified either in command-line style
(that is, as C<< spacetrack( '-json', ... ) >>) or as a hash reference
(that is, as C<< spacetrack( { json => 1 }, ... ) >>).

This method returns an L<HTTP::Response|HTTP::Response> object. If the
operation succeeded, the content of the response will be the requested
data, unzipped if you used the version 1 interface.

If you requested a non-existent catalog, the response code will be
C<HTTP_NOT_FOUND> (a.k.a.  404); otherwise the response code will be
whatever the underlying HTTPS request returned.

A Space Track username and password are required to use this method.

If this method succeeds, the response will contain headers

 Pragma: spacetrack-type = orbit
 Pragma: spacetrack-source = spacetrack

These can be accessed by C<< $st->content_type( $resp ) >> and

t/query_celestrak.t  view on Meta::CPAN


    is $st->content_type( $resp ), 'orbit', "Result type is 'orbit'";

    is $st->content_source( $resp ), 'celestrak',
	"Result source is 'celestrak'";
}

SKIP: {

    is_error_or_skip( $st, celestrak => 'fubar',
	404, 'Direct-fetch non-existent Celestrak catalog' );

}

SKIP: {
    is_success_or_skip( $st, celestrak_supplemental => 'iss',
	'Fetch Celestrak supplemental ISS data', 2 );

    is $st->content_type(), 'orbit', "Content type is 'orbit'";

    is $st->content_source(), 'celestrak', "Content source is 'celestrak'";

t/query_mccants.t  view on Meta::CPAN

SKIP: {
    is_success_or_skip( $st, qw{ mccants integrated },
	'Get integrated elements', 2 );

    is $st->content_type(), 'orbit', "Content type is 'orbit'";

    is $st->content_source(), 'mccants', "Content source is 'mccants'";
}

SKIP: {
    local $TODO = '404 2024-04-27';

    is_success_or_skip( $st, qw{ mccants rcs }, 'Get McCants-format RCS data', 2 );

    is $st->content_type(), 'rcs.mccants', "Content type is 'rcs.mccants'";

    is $st->content_source(), 'mccants', "Content source is 'mccants'";
}

done_testing;

t/query_spacetrack.t  view on Meta::CPAN


    not_defined( $st->content_source( $rslt ),
	    'Result source should be undef' )
	or diag( 'content_source is ', $st->content_source( $rslt ) );

    not_defined( $st->content_interface( $rslt ),
	    'Result interface should be undef' )
	or diag 'content_interface is ', $st->content_interface( $rslt );

    is_error( $st, spacetrack => 'fubar',
	404, 'Fetch a non-existent catalog entry' );

    SKIP: {
	is_success_or_skip( $st, spacetrack => 'inmarsat',
	    'Fetch a catalog entry', 3 );

	is $st->content_type(), 'orbit', "Content type is 'orbit'";

	is $st->content_source(), 'spacetrack',
	    "Content source is 'spacetrack'";



( run in 2.475 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )