astroplan: HTTPError: Forbidden for download_IERS_A()

Run into this in #177. I’ve repushed the latest commit, but it seems to be more than just a fluke and failed again. I hasn’t managed to reproduce it locally.

A failing build, e.g. https://travis-ci.org/astropy/astroplan/jobs/147020338

WARNING: failed to download http://maia.usno.navy.mil/ser7/finals2000A.all, using local IERS-B: HTTP Error 403: Forbidden [astropy.utils.iers.iers]

/home/travis/miniconda/envs/test/lib/python3.5/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.

  warnings.warn(self.msg_depr % (key, alt_key))

WARNING: Tried to get polar motions for times after IERS data is valid. Defaulting to polar motion from the 50-yr mean for those. This may affect precision at the 10s of arcsec level [astropy.coordinates.builtin_frames.utils]

WARNING: (some) times are outside of range covered by IERS table. Assuming UT1-UTC=0 for coordinate transformations. [astropy.coordinates.builtin_frames.utils]

WARNING: OldEarthOrientationDataWarning: For best precision (on the order of arcseconds), you must download an up-to-date IERS Bulletin A table. To do so, run:

>>> from astroplan import download_IERS_A

>>> download_IERS_A()

 [astroplan.utils]

WARNING: failed to download http://maia.usno.navy.mil/ser7/finals2000A.all, using local IERS-B: HTTP Error 403: Forbidden [astropy.utils.iers.iers]

WARNING: OldEarthOrientationDataWarning: For best precision (on the order of arcseconds), you must download an up-to-date IERS Bulletin A table. To do so, run:

>>> from astroplan import download_IERS_A

>>> download_IERS_A()

 [astroplan.utils]

/home/travis/build/astropy/astroplan/docs/faq/iers.rst:75: WARNING: Exception occurred in plotting iers-1

 from /home/travis/build/astropy/astroplan/docs/faq/iers.rst:

Traceback (most recent call last):

  File "/home/travis/miniconda/envs/test/lib/python3.5/site-packages/matplotlib/sphinxext/plot_directive.py", line 517, in run_code

    six.exec_(code, ns)

  File "<string>", line 11, in <module>

  File "/home/travis/miniconda/envs/test/lib/python3.5/site-packages/astropy/utils/data.py", line 1097, in download_file

    raise e

  File "/home/travis/miniconda/envs/test/lib/python3.5/site-packages/astropy/utils/data.py", line 1030, in download_file

    remote_url, timeout=timeout)) as remote:

  File "/home/travis/miniconda/envs/test/lib/python3.5/urllib/request.py", line 163, in urlopen

    return opener.open(url, data, timeout)

  File "/home/travis/miniconda/envs/test/lib/python3.5/urllib/request.py", line 472, in open

    response = meth(req, response)

  File "/home/travis/miniconda/envs/test/lib/python3.5/urllib/request.py", line 582, in http_response

    'http', request, response, code, msg, hdrs)

  File "/home/travis/miniconda/envs/test/lib/python3.5/urllib/request.py", line 510, in error

    return self._call_chain(*args)

  File "/home/travis/miniconda/envs/test/lib/python3.5/urllib/request.py", line 444, in _call_chain

    result = func(*args)

  File "/home/travis/miniconda/envs/test/lib/python3.5/urllib/request.py", line 590, in http_error_default

    raise HTTPError(req.full_url, code, msg, hdrs, fp)

urllib.error.HTTPError: HTTP Error 403: Forbidden

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (15 by maintainers)

Most upvoted comments

Can confirm ☝️

>>> import astroplan
>>> astroplan.download_IERS_A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/astroplan/utils.py", line 127, in download_IERS_A
    show_progress=show_progress)
  File "/usr/lib64/python3.6/site-packages/astropy/utils/data.py", line 1126, in download_file
    raise e
  File "/usr/lib64/python3.6/site-packages/astropy/utils/data.py", line 1059, in download_file
    remote_url, timeout=timeout)) as remote:
  File "/usr/lib64/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib64/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib64/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

Here’s how I fixed it, for anyone else looking for the fix:

>>> import astropy
>>> astropy.utils.iers.IERS_A_URL = 'http://toshi.nofs.navy.mil/ser7/finals2000A.all'
>>> astroplan.download_IERS_A()
Downloading http://toshi.nofs.navy.mil/ser7/finals2000A.all
|=========================================| 3.2M/3.2M (100.00%)         4s

Having the download_IERS_A function try the backup if the original fails seems to be the obvious solution.