Skip to content

Commit f14f0a5

Browse files
authored
Merge pull request #1874 from tinumide/issue-1803
changed warning to error for authentication failure
2 parents 1d644b4 + bc3d158 commit f14f0a5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ sdss
156156
- Optional keyword arguments are now keyword only. [#2477, #2532]
157157

158158

159+
mast
160+
^^^^
161+
162+
- Changed warning to error for authentication failure. [#1874]
163+
164+
165+
159166
Infrastructure, Utility and Other Changes and Additions
160167
-------------------------------------------------------
161168

astroquery/mast/auth.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
import os
1111
import keyring
12-
import warnings
1312

1413
from getpass import getpass
1514

1615
from astroquery import log
1716

18-
from ..exceptions import AuthenticationWarning
17+
from ..exceptions import LoginError
1918

2019
from . import conf
2120

@@ -82,10 +81,8 @@ def login(self, token=None, store_token=False, reenter_token=False):
8281
if not info["anon"]:
8382
log.info("MAST API token accepted, welcome {}".format(info["attrib"].get("display_name")))
8483
else:
85-
warn_msg = ("MAST API token invalid!\n"
86-
"To make create a new API token visit to following link: " +
87-
self.AUTH_URL)
88-
warnings.warn(warn_msg, AuthenticationWarning)
84+
raise LoginError("MAST API token invalid!\n To create a new API token"
85+
"visit to following link: " + self.AUTH_URL)
8986

9087
return not info["anon"]
9188

0 commit comments

Comments
 (0)