Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore warnings at import time in astrometry.net #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions astroquery/astrometry_net/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def show_allowed_settings(self):
default=key_info['default'],
values=key_info['allowed']))

def __init__(self):
def __init__(self, ignore_warning=False):
""" Show a warning message if the API key is not in the configuration file. """
super(AstrometryNetClass, self).__init__()
if not conf.api_key:
if not ignore_warning and not conf.api_key:
log.warning("Astrometry.net API key not found in configuration file")
log.warning("You need to manually edit the configuration file and add it")
log.warning(
Expand Down Expand Up @@ -417,4 +417,5 @@ def solve_from_image(self, image_file_path, force_image_upload=False,


# the default tool for users to interact with is an instance of the Class
AstrometryNet = AstrometryNetClass()
# we default to ignoring the warning so this warning isn't raised at import time
AstrometryNet = AstrometryNetClass(ignore_warning=True)