Skip to main content

Query whereistheplanet.com from Python

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

querytheplanet-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

querytheplanet-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file querytheplanet-0.1.1.tar.gz.

File metadata

  • Download URL: querytheplanet-0.1.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for querytheplanet-0.1.1.tar.gz
Algorithm Hash digest
SHA256 20eb45b882dd271ddc68ead5405c3a7ab350acb1dc486842b8d76382f9fc7a81
MD5 490b5623c77230d9d78cb95357534a91
BLAKE2b-256 63c1e5cd8f75f5fddfe1fda0845ffdf5e4b96725d14ef3901720ab8c6326aeed

See more details on using hashes here.

File details

Details for the file querytheplanet-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: querytheplanet-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for querytheplanet-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60738871825b451fc8b272d305ec7d7cff8f8fcca42160c9624b5b844ae62dd4
MD5 30a3bd1ad6d601c3c57ef170bce3936f
BLAKE2b-256 84a2ab804f2bf95f159973728a7e7e8d5176a7e53d78973a7ce590615578771c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page