Skip to content

SSL/URL error when trying to connect to HITRAN via hapi #50

@emccaughey

Description

@emccaughey

I have been trying to connect to HITRAN via hapi and and keep receiving an ssl/url error.

I am using a macOS 14.4.1 with python 3.9.13. I am able to access HITRAN.org via any web browser, but am not able to fetch data using hapi.

I have tried using this fix with a variety of HAPI versions, with no luck.

I have also seen some other people online who may be having this same issue.

One Error:

HAPI version: 1.2.2.0
To get the most up-to-date version please check http://hitran.org/hapi
ATTENTION: Python versions of partition sums from TIPS-2021 are now available in HAPI code

           MIT license: Copyright 2021 HITRAN team, see more at http://hitran.org. 

           If you use HAPI in your research or software development,
           please cite it using the following reference:
           R.V. Kochanov, I.E. Gordon, L.S. Rothman, P. Wcislo, C. Hill, J.S. Wilzewski,
           HITRAN Application Programming Interface (HAPI): A comprehensive approach
           to working with spectroscopic data, J. Quant. Spectrosc. Radiat. Transfer 177, 15-30 (2016)
           DOI: 10.1016/j.jqsrt.2016.03.005

           ATTENTION: This is the core version of the HITRAN Application Programming Interface.
                      For more efficient implementation of the absorption coefficient routine, 
                      as well as for new profiles, parameters and other functional,
                      please consider using HAPI2 extension library.
                      HAPI2 package is available at http://github.com/hitranonline/hapi2

Using lahetra


Data is fetched from http://hitran.org

Traceback (most recent call last):

  File "/Users/erinmccaughey/Desktop/hapi_tests/hapi.py", line 3276, in queryHITRAN
    req = urllib2.urlopen(url)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 555, in error
    result = self._call_chain(*args)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 747, in http_error_302
    return self.parent.open(new, timeout=req.timeout)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 539, in _open
    return self._call_chain(self.handle_open, 'unknown',

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/urllib/request.py", line 1417, in unknown_open
    raise URLError('unknown url type: %s' % type)

URLError: <urlopen error unknown url type: https>


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/Users/erinmccaughey/opt/anaconda3/lib/python3.9/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/erinmccaughey/Desktop/hapi_tests/hapi_test.py", line 23, in <module>
    fetch_by_ids('co2_sdv_6056cm_primary',[7],6056,6064,ParameterGroups=['160-char','SDVoigt_Air'])

  File "/Users/erinmccaughey/Desktop/hapi_tests/hapi.py", line 5324, in fetch_by_ids
    queryHITRAN(

  File "/Users/erinmccaughey/Desktop/hapi_tests/hapi.py", line 3281, in queryHITRAN
    raise Exception(

Exception: Cannot connect to http://hitran.org. Try again or edit GLOBAL_HOST variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions