Skip to content

Commit

Permalink
Revert "Only grab server/API URL during initialization."
Browse files Browse the repository at this point in the history
This reverts commit da856a5.
  • Loading branch information
mkelley committed May 27, 2022
1 parent a071501 commit 4df2333
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions astroquery/jplhorizons/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def __init__(self, id=None, location=None, epochs=None,
self.id = id
self.location = location

self.server_url = conf.horizons_server

# check for epochs to be dict or list-like; else: make it a list
if epochs is not None:
if isinstance(epochs, (list, tuple, ndarray)):
Expand Down Expand Up @@ -513,6 +511,8 @@ def ephemerides_async(self, airmass_lessthan=99,
"""

URL = conf.horizons_server

# check for required information
if self.id is None:
raise ValueError("'id' parameter not set. Query aborted.")
Expand Down Expand Up @@ -611,7 +611,7 @@ def ephemerides_async(self, airmass_lessthan=99,
return request_payload

# query and parse
response = self._request('GET', self.server_url, params=request_payload,
response = self._request('GET', URL, params=request_payload,
timeout=self.TIMEOUT, cache=cache)
self.uri = response.url

Expand Down Expand Up @@ -743,6 +743,8 @@ def elements_async(self, get_query_payload=False,
"""

URL = conf.horizons_server

# check for required information
if self.id is None:
raise ValueError("'id' parameter not set. Query aborted.")
Expand Down Expand Up @@ -819,7 +821,7 @@ def elements_async(self, get_query_payload=False,
return request_payload

# query and parse
response = self._request('GET', self.server_url, params=request_payload,
response = self._request('GET', URL, params=request_payload,
timeout=self.TIMEOUT, cache=cache)
self.uri = response.url

Expand Down Expand Up @@ -973,6 +975,8 @@ def vectors_async(self, get_query_payload=False,
"""

URL = conf.horizons_server

# check for required information
if self.id is None:
raise ValueError("'id' parameter not set. Query aborted.")
Expand Down Expand Up @@ -1055,7 +1059,7 @@ def vectors_async(self, get_query_payload=False,
return request_payload

# query and parse
response = self._request('GET', self.server_url, params=request_payload,
response = self._request('GET', URL, params=request_payload,
timeout=self.TIMEOUT, cache=cache)
self.uri = response.url

Expand Down

0 comments on commit 4df2333

Please sign in to comment.