Skip to content

Commit

Permalink
🎨 Replace 200 constant by requests value
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Aug 1, 2024
1 parent 243deda commit 7ca319a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ipyaladin/utils/_coordinate_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from astropy.coordinates import SkyCoord, Angle
import re

OK_STATUS_CODE = 200


def parse_coordinate_string(string: str, body: str = "sky") -> SkyCoord:
"""Parse a string containing coordinates.
Expand Down Expand Up @@ -63,7 +61,7 @@ def _from_name_on_planet(string: str, body: str) -> SkyCoord:
f"?identifier={string.replace(' ', '+')}&body={body}&threshold=0.7&format=json"
)
request = requests.get(url)
if request.status_code != OK_STATUS_CODE:
if request.status_code != requests.codes.ok:
raise ValueError(f"Invalid coordinate string: {string}")
data = request.json()
lat = data["data"][0][5]
Expand Down

0 comments on commit 7ca319a

Please sign in to comment.