Astro-SpaceTrack

 view release on metacpan or  search on metacpan

inc/Astro/SpaceTrack/Dumper.pm  view on Meta::CPAN

	    defined( my $revised = $code->( $content ) )
		or next;
	    $content = $revised;
	    last;
	}
	my @data = (
	    $resp->code(),
	    $resp->message(),
	    [ 
		_dump_header_item( $resp, 'Content-Type' ),
		_dump_header_item( $resp, 'Set-Cookie',
		    "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
		),
		_dump_header_item( $resp, 'Status' ),
	    ],
	    $content,
	);

	Mock::LWP::UserAgent::__modify_data(
	    $self->{ +__PACKAGE__ }, $url, $method, \@data );

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

	my $self = bless {}, $class;
	$self->{ +__PACKAGE__ } = __load_data();
	return $self;
    };

    *LWP::UserAgent::cookie_jar = sub {
	my ( $self, $data ) = @_;
	my $old = $self->{cookie_jar};
	if ( $data ) {
	    if ( REF_HASH eq ref $data ) {
		require HTTP::Cookies;
		$data = HTTP::Cookies->new( %{ $data } );
	    }
	    $self->{cookie_jar} = $data;
	}
	return $old;
    };

    *LWP::UserAgent::env_proxy = sub {
	return;
    };

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

	and not defined $expires
	and $expires = time + 3600;

    if ( defined $cookie ) {
	$interface_info->{session_cookie} = $cookie;
	$self->{dump_headers} & DUMP_TRACE
	    and warn "Session cookie: $cookie\n";	## no critic (RequireCarping)
	if ( exists $interface_info->{cookie_expires} ) {
	    $interface_info->{cookie_expires} = $expires;
	    $self->{dump_headers} & DUMP_TRACE
		and warn 'Cookie expiration: ',
		    POSIX::strftime( '%d-%b-%Y %H:%M:%S', localtime $expires ),
		    " ($expires)\n";	## no critic (RequireCarping)
	    return $expires > time;
	}
	return $interface_info->{session_cookie} ? 1 : 0;
    } else {
	$self->{dump_headers} & DUMP_TRACE
	    and warn "Session cookie not found\n";	## no critic (RequireCarping)
	return;
    }

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

	    $deprecate{$method}{$argument} = 0;
	} else {
	    $deprecate{$method} = 0;
	}
	return;
    }

}

#	_dump_cookie is intended to be called from inside the
#	HTTP::Cookie->scan method. The first argument is prefix text
#	for the dump, and the subsequent arguments are the arguments
#	passed to the scan method.
#	It dumps the contents of the cookie to STDERR via a warn ().
#	A typical session cookie looks like this:
#	    version => 0
#	    key => 'spacetrack_session'
#	    val => whatever
#	    path => '/'
#	    domain => 'www.space-track.org'
#	    port => undef

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access /\non this server.<br />\n</p>\n<p>Additionally, a 403 Forbidden\ner...
      ]
   },
   "https://www.space-track.org/" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/html; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org"
         ],
         ""
      ]
   },
   "https://www.space-track.org/ajaxauth/login" : {
      "POST" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "\"\""
      ]
   },
   "https://www.space-track.org/basicspacedata/modeldef/class/tle_latest" : {
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "[\n   {\n      \"COMMENT\" : null,\n      \"COMMENTCODE\" : null,\n      \"COUNTRY\" : \"CIS\",\n      \"DECAY\" : \"2010-01-10\",\n      \"FILE\" : \"5942\",\n      \"INTLDES\" : \"1993-036WY\",\n      \"LAUNCH\" : \"1993-06-16\",\n      \...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/LAUNCH/2009-04-01" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "[]"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/LAUNCH/2012-06-13" : {
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "[\n   {\n      \"COMMENT\" : null,\n      \"COMMENTCODE\" : null,\n      \"COUNTRY\" : \"US\",\n      \"DECAY\" : null,\n      \"FILE\" : \"6881\",\n      \"INTLDES\" : \"2012-031A\",\n      \"LAUNCH\" : \"2012-06-13\",\n      \"LAUNCH_NUM\...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/OBJECT_ID/1998-067A" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "[\n   {\n      \"COMMENT\" : null,\n      \"COMMENTCODE\" : \"0\",\n      \"COUNTRY\" : \"ISS\",\n      \"DECAY\" : null,\n      \"FILE\" : \"5049\",\n      \"INTLDES\" : \"1998-067A\",\n      \"LAUNCH\" : \"1998-11-20\",\n      \"LAUNCH_NU...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/OBJECT_ID/~~1998-067" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "[\n   {\n      \"COMMENT\" : null,\n      \"COMMENTCODE\" : \"0\",\n      \"COUNTRY\" : \"ISS\",\n      \"DECAY\" : null,\n      \"FILE\" : \"5049\",\n      \"INTLDES\" : \"1998-067A\",\n      \"LAUNCH\" : \"1998-11-20\",\n      \"LAUNCH_NU...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/OBJECT_NAME/~~tiangong" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "[\n   {}\n]\n"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/OBJECT_NAME/~~zarya" : {
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "[\n   {\n      \"COMMENT\" : null,\n      \"COMMENTCODE\" : null,\n      \"COUNTRY\" : \"ISS\",\n      \"DECAY\" : null,\n      \"FILE\" : \"6877\",\n      \"INTLDES\" : \"1998-067A\",\n      \"LAUNCH\" : \"1998-11-20\",\n      \"LAUNCH_NUM...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/satcat/format/json/orderby/OBJECT_NUMBER%20asc/predicates/all/CURRENT/Y/DECAY/null-val/OBJECT_NUMBER/25544" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "[\n   {\n      \"COMMENT\" : null,\n      \"COMMENTCODE\" : \"0\",\n      \"COUNTRY\" : \"ISS\",\n      \"DECAY\" : null,\n      \"FILE\" : \"5055\",\n      \"INTLDES\" : \"1998-067A\",\n      \"LAUNCH\" : \"1998-11-20\",\n      \"LAUNCH_NU...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle/format/tle/orderby/OBJECT_NUMBER%20asc/EPOCH/2012-04-01%2000:00:00--2012-04-02%2000:00:00/OBJECT_NUMBER/25544" : {
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "[\n   {\n      \"COMMENT\" : \"GENERATED VIA SPACETRACK.ORG API\",\n      \"FILE\" : \"2434103\",\n      \"INTLDES\" : \"98067A\",\n      \"NORAD_CAT_ID\" : \"25544\",\n      \"OBJECT_ID\" : \"1998-067A\",\n      \"OBJECT_NAME\" : \"ISS (ZA...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/3le/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/25544/ORDINAL/1" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "0 ISS (ZARYA)\r\n1 25544U First line of data\r\n2 25544 Second line of data\r\n"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/3le/orderby/OBJECT_NUMBER%20asc/predicates/OBJECT_NAME,TLE_LINE1,TLE_LINE2/OBJECT_NUMBER/25544,39496,39512--39515,39518--39521,39525--39532,39555--39564,39566--39571/ORDINAL...
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "ISS (ZARYA)\r\n1 25544U First line of data\r\n2 25544 Second line of data\r\nISS DEB (VSPLESK PLTFRM)\r\n1 39496U First line of data\r\n2 39496 Second line of data\r\nFLOCK 1-3\r\n1 39512U First line of data\r\n2 39512 Second line of data\r...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/3le/orderby/OBJECT_NUMBER%20asc/predicates/OBJECT_NAME,TLE_LINE1,TLE_LINE2/OBJECT_NUMBER/25544/ORDINAL/1" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "ISS (ZARYA)\r\n1 25544U First line of data\r\n2 25544 Second line of data\r\n"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/json/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/25544/ORDINAL/1" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "application/json",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "[\n   {\n      \"COMMENT\" : \"GENERATED VIA SPACETRACK.ORG API\",\n      \"FILE\" : \"1681502\",\n      \"INTLDES\" : \"98067A\",\n      \"NORAD_CAT_ID\" : \"25544\",\n      \"OBJECT_ID\" : \"1998-067A\",\n      \"OBJECT_NAME\" : \"ISS (ZA...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/EPOCH/%3Enow-30/OBJECT_NAME/inmarsat~~/OBJECT_TYPE/payload/ORDINAL/1" : {
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "1 20918U First line of data\r\n2 20918 Second line of data\r\n1 21149U First line of data\r\n2 21149 Second line of data\r\n1 21814U First line of data\r\n2 21814 Second line of data\r\n1 21940U First line of data\r\n2 21940 Second line of ...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/1--50/ORDINAL/1" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "1 00004U First line of data\r\n2 00004 Second line of data\r\n1 00005U First line of data\r\n2 00005 Second line of data\r\n1 00008U First line of data\r\n2 00008 Second line of data\r\n1 00009U First line of data\r\n2 00009 Second line of ...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/25544,36086,41765,41834,42706,42711--42713,42715,42722,42726,42736,42982,43020,43021,43466--43468,43546--43554,43556--43561,435...
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "1 25544U First line of data\r\n2 25544 Second line of data\r\n1 25545U First line of data\r\n2 25545 Second line of data\r\n1 25546U First line of data\r\n2 25546 Second line of data\r\n"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/25544/ORDINAL/1" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "1 25544U First line of data\r\n2 25544 Second line of data\r\n"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/25544/ORDINAL/1--5" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "1 25544U First line of data\r\n2 25544 Second line of data\r\n1 25544U First line of data\r\n2 25544 Second line of data\r\n1 25544U First line of data\r\n2 25544 Second line of data\r\n1 25544U First line of data\r\n2 25544 Second line of ...
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/34627,35691/ORDINAL/1" : {
      "GET" : [
         "200",

t/data/Mock-LWP-UserAgent/resp.json  view on Meta::CPAN

         "1 38358U First line of data\r\n2 38358 Second line of data\r\n1 38359U First line of data\r\n2 38359 Second line of data\r\n"
      ]
   },
   "https://www.space-track.org/basicspacedata/query/class/tle_latest/format/tle/orderby/OBJECT_NUMBER%20asc/OBJECT_NUMBER/51--66/ORDINAL/1" : {
      "GET" : [
         "200",
         "OK",
         [
            "Content-Type",
            "text/plain; charset=UTF-8",
            "Set-Cookie",
            "chocolatechip=This bears no relation to any cookie set by Space Track; path=/; domain=www.space-track.org",
            "Status",
            "200"
         ],
         "1 00051U First line of data\r\n2 00051 Second line of data\r\n1    52U First line of data\r\n2    52 Second line of data\r\n1 00053U First line of data\r\n2 00053 Second line of data\r\n1 00054U First line of data\r\n2 00054 Second line of ...
      ]
   }
}



( run in 0.404 second using v1.01-cache-2.11-cpan-e9199f4ba4c )