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.
-
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.
-
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
classThis 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 onlyEvents
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 onlyLaunches
requested.- Parameters
- 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
andEvents
. 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 nLaunches
, 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.