From 4df2333c9e53c8cae812e6f3935d95c04c177290 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Fri, 27 May 2022 11:56:01 -0400 Subject: [PATCH] Revert "Only grab server/API URL during initialization." This reverts commit da856a5d68f513e56960434c10fcbbbd1671f921. --- astroquery/jplhorizons/core.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 178925ef2a..c06d11a309 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -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)): @@ -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.") @@ -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 @@ -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.") @@ -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 @@ -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.") @@ -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