Skip to main content

Query the Planet

Query http://whereistheplanet.com from Python.

There is already a Python version of whereistheplanet, but it is requires orbitize! and git-lfs, plus it is not available on PyPI.

This aims to be a lighter version with no dependencies that directly queries the website. This means it does require a network connection.

Installation

Install directly from PyPI:

python -m pip install querytheplanet

Installing for development

To install for development, first clone the repository (or ideally your fork of it), e.g.:

git clone https://github.com/vandalt/querytheplanet.git

Then install with development dependencies in editable mode:

python -m pip install -e ".[dev]"

To run the tests, do:

python -m pytest

Usage

Command line

List available planets:

querytheplanet -l

Query one or more planet positions for today:

querytheplanet 51erib betapicb

Query the position of one or more planets for a given date:

querytheplanet 51erib betapicb --date 2026-05-01

Query the position of one or more planets for a multiple dates:

querytheplanet 51erib betapicb --date 2023-01-01 2026-05-01

Save the results to a CSV:

querytheplanet 51erib betapicb --date 2023-01-01 2026-05-01 --output results.csv

Display help:

querytheplanet -h

From Python

The main functionality is accessible from the querytheplanet module directly. Here is a small script with examples:

import querytheplanet as qtp

# Get a list of available planets that can be used in queries
all_planets = qtp.fetch_available_planets()

# Query a single planet's location for today
pos_df = query_planet_locations("51erib")

# Query for another date
pos_df_date =query_planet_locations("51erib", date="2025-01-01")

# Query multiple planets and multiple dates
pos_df_multi = query_planet_locations(["51erib", "betapicb"], date=["2025-01-01", "2026-05-01"])

The query outputs are always returned as pandas Dataframes. To print the outputs in a more readable format, pass verbose=True to query_planet_locations().

Attributions

This is a thin wrapper that calls http://whereistheplanet.com, maintained here: https://github.com/semaphoreP/whereistheplanet.

If you used this for your research, please cite the ASCL entry of it:

Wang, J. J., Kulikauskas, M., Blunt, S. 2021, Astrophysics Source Code Library, ascl:2101.003

Release files for querytheplanet 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for querytheplanet 0.1.1
File Size Uploaded
querytheplanet-0.1.1.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for querytheplanet 0.1.1
File Interpreter ABI Platform
querytheplanet-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / querytheplanet-0.1.1.tar.gz

Download URL querytheplanet-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
20eb45b882dd271ddc68ead5405c3a7ab350acb1dc486842b8d76382f9fc7a81
BLAKE2b-256 checksum
How to use checksums
63c1e5cd8f75f5fddfe1fda0845ffdf5e4b96725d14ef3901720ab8c6326aeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / querytheplanet-0.1.1-py3-none-any.whl

Download URL querytheplanet-0.1.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60738871825b451fc8b272d305ec7d7cff8f8fcca42160c9624b5b844ae62dd4
BLAKE2b-256 checksum
How to use checksums
84a2ab804f2bf95f159973728a7e7e8d5176a7e53d78973a7ce590615578771c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page