nextinspace

class nextinspace.Event(name: Optional[str], location: Optional[str], date: datetime.datetime, description: Optional[str], type_: Optional[str])[source]

Bases: object

Generic space event.

This constructor is meant for private use. This class is documented solely for its attributes.

Note

When the LL2 API does not provide a date for the Event, the date attribute is set to datetime(datetime.MINYEAR, 1, 1). This is so the Event is sorted to the back of the returned tuple.

class nextinspace.Launch(name: Optional[str], location: Optional[str], date: datetime.datetime, description: Optional[str], type_: Optional[str], launcher: Optional[nextinspace.Launcher])[source]

Bases: nextinspace.Event

Launch event

This constructor is meant for private use. This class is documented solely for its attributes.

Note

When the LL2 API does not provide a date for the Launch, the date attribute is set to datetime(datetime.MINYEAR, 1, 1). This is so the Launch is sorted to the back of the returned tuple.

class nextinspace.Launcher(name: Optional[str], payload_leo: Optional[float], payload_gto: Optional[float], liftoff_thrust: Optional[float], liftoff_mass: Optional[float], max_stages: Optional[int], height: Optional[float], successful_launches: Optional[int], consecutive_successful_launches: Optional[int], failed_launches: Optional[int], maiden_flight_date: datetime.datetime)[source]

Bases: object

Holds launcher information for instances of the Launch class

This constructor is meant for private use. This class is documented solely for its attributes.

Note

When the LL2 API does not provide a maiden flight date for the Launcher, the maiden_flight_date attribute is set to datetime(datetime.MINYEAR, 1, 1).

nextinspace.next_event(num_events: int) → Tuple[nextinspace.Event, ][source]

Same as nextinspace() but only Events requested.

Parameters

num_events (int) – Number of Events to get from the API

Returns

Upcoming Events. Note that the length of this tuple will be <= num_events.

Return type

Tuple

Raises

requests.exceptions.RequestException – If there is a problem connecting to the API. Also does a raise_for_status() call so HTTP errors are possible as well.

nextinspace.next_launch(num_launches: int, include_launcher: bool = False) → Tuple[nextinspace.Launch, ][source]

Same as nextinspace() but only Launches requested.

Parameters
  • num_launches (int) – Number of Launches to get from the API

  • include_launcher (bool, optional) – Whether to include the launcher of the requested Launches, defaults to False

Returns

Upcoming Launches. Note that the length of this tuple will be <= num_launches.

Return type

Tuple

Raises

requests.exceptions.RequestException – If there is a problem connecting to the API. Also does a raise_for_status() call so HTTPErrors are possible as well.

nextinspace.nextinspace(num_items: int, include_launcher: bool = False) → Tuple[Union[nextinspace.Launch, nextinspace.Event], ][source]

This gets the next (specified number) of items from the LL2 API.

Parameters
  • num_items (int) – Number of items to get from the API

  • include_launcher (bool, optional) – Whether to include the launcher of the requested Launches, defaults to False

Returns

Upcoming Launches and Events. Note that the length of this tuple will be <= num_items.

Return type

Tuple

Raises

requests.exceptions.RequestException – If there is a problem connecting to the API. Also does a raise_for_status() call so HTTPErrors are possible as well.

Warning

Because the LL2 API does not offer any way of getting n upcoming spaceflight items, this function must query the API twice, once for the next n Events, and once for the next n Launches, and merge the queries into a sorted form. As such, this function may be slower than anticipated. 🙁

Deprecated since version 2.0.3: Because the filter by time function of the LL2 API is currently broken, upcoming means beyond and including today.