Repository: astropy/astroquery

Issue:
BUG: SDSS KeyNotFoundException for query_region
Hi, I am having the same problem with:
astroquery 0.4.7.d
python 3.10.9
numpy 1.23.5.

Using (for example) the example in the doc, as any other call:

```
from astropy.coordinates import SkyCoord
from astroquery.sdss import SDSS

pos = SkyCoord('0h8m05.63s +14d50m23.3s', frame='icrs')
xid = SDSS.query_region(pos, spectro=True)


Traceback (most recent call last):

  File "/var/folders/m2/32fmbv0s3hg46rj5ccx2r5g40000gn/T/ipykernel_49747/284473386.py", line 2, in <module>
    xid = SDSS.query_region(pos, spectro=True)

  File "/Users/filippo/opt/anaconda3/envs/Py310/lib/python3.10/site-packages/astroquery/utils/class_or_instance.py", line 25, in f
    return self.fn(obj, *args, **kwds)

  File "/Users/filippo/opt/anaconda3/envs/Py310/lib/python3.10/site-packages/astroquery/utils/process_asyncs.py", line 29, in newmethod
    result = self._parse_result(response, verbose=verbose)

  File "/Users/filippo/opt/anaconda3/envs/Py310/lib/python3.10/site-packages/astroquery/sdss/core.py", line 905, in _parse_result
    arr = np.atleast_1d(np.genfromtxt(io.BytesIO(response.content),

  File "/Users/filippo/opt/anaconda3/envs/Py310/lib/python3.10/site-packages/numpy/lib/npyio.py", line 2291, in genfromtxt
    raise ValueError(errmsg)

ValueError: Some errors were detected !
    Line #3 (got 3 columns instead of 1)
    Line #5 (got 3 columns instead of 1)
    Line #6 (got 4 columns instead of 1)
    Line #8 (got 4 columns instead of 1)
    Line #12 (got 4 columns instead of 1)
    Line #15 (got 6 columns instead of 1)
    Line #17 (got 4 columns instead of 1)
    Line #21 (got 3 columns instead of 1)
    Line #31 (got 3 columns instead of 1)
```

It works fine on another machine running python 3.8 and astroquery 0.4.3

Discussion:

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index b5e250b5..d684e740 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -151,6 +151,12 @@ oac
 - Fix bug in parsing events that contain html tags (e.g. in their alias
   field). [#2423]
 
+sdss
+^^^^
+
+- Switching to https to avoid issues originating in relying on server side
+  redirects. [#2654]
+
 simbad
 ^^^^^^
 
diff --git a/astroquery/sdss/__init__.py b/astroquery/sdss/__init__.py
index 4e7e7691..6ef7ebbd 100644
--- a/astroquery/sdss/__init__.py
+++ b/astroquery/sdss/__init__.py
@@ -11,7 +11,7 @@ class Conf(_config.ConfigNamespace):
     Configuration parameters for `astroquery.sdss`.
     """
     skyserver_baseurl = _config.ConfigItem(
-        'http://skyserver.sdss.org',
+        'https://skyserver.sdss.org',
         'Base URL for catalog-related queries like SQL and Cross-ID.')
     sas_baseurl = _config.ConfigItem(
         'https://data.sdss.org/sas',


Test patch:
diff --git a/astroquery/sdss/tests/test_sdss.py b/astroquery/sdss/tests/test_sdss.py
index 55a5238d..33e28588 100644
--- a/astroquery/sdss/tests/test_sdss.py
+++ b/astroquery/sdss/tests/test_sdss.py
@@ -123,25 +123,25 @@ dr_list = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
 # interfaces are supported for DR11."
 def url_tester(data_release):
     if data_release < 10:
-        baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/search/x_sql.asp'
+        baseurl = 'https://skyserver.sdss.org/dr{}/en/tools/search/x_sql.asp'
     if data_release == 10:
-        baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/search/x_sql.aspx'
+        baseurl = 'https://skyserver.sdss.org/dr{}/en/tools/search/x_sql.aspx'
     if data_release == 11:
         return
     if data_release >= 12:
-        baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/search/x_results.aspx'
+        baseurl = 'https://skyserver.sdss.org/dr{}/en/tools/search/x_results.aspx'
     assert sdss.SDSS._last_url == baseurl.format(data_release)
 
 
 def url_tester_crossid(data_release):
     if data_release < 10:
-        baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/crossid/x_crossid.asp'
+        baseurl = 'https://skyserver.sdss.org/dr{}/en/tools/crossid/x_crossid.asp'
     if data_release == 10:
-        baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/crossid/x_crossid.aspx'
+        baseurl = 'https://skyserver.sdss.org/dr{}/en/tools/crossid/x_crossid.aspx'
     if data_release == 11:
         return
     if data_release >= 12:
-        baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/search/X_Results.aspx'
+        baseurl = 'https://skyserver.sdss.org/dr{}/en/tools/search/X_Results.aspx'
     assert sdss.SDSS._last_url == baseurl.format(data_release)