Visitar URL original
SSL Errors · Issue #5 · acode/lib-python · GitHub
Skip to content

SSL Errors #5

Description

@mwishoff

Hey, so I started trying to use the library and was encountering a few SSL errors.

lib=4.0.0
OpenSSL v1.1.1c
Tried with python 3.6.4, and python 3.7.4

The first error I was getting was:
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:777)

Without updating my code or changing anything it is now displaying a different SSl error:
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)

I've tried two ways, both return the same SSL Wrong Version Number.

First:
lib.cfg['token'] = 'MY_TOKEN'
HaloAPI = lib.halo.infinite['@0.2.0']
result = HaloAPI.stats.matches.list(gamertag='citizen kwho')
pprint(result)

Second:
url = 'https://halo.api.stdlib.com/infinite@0.2.0/stats/matches/retrieve/'
params = {
'id': '26829e9a-7fab-4c2b-ac28-a62360e55946',
'Content-Type': 'application/json'
}
headers = {
'Authorization': f'Bearer {dev_token}'
}
response = requests.get(url, params=params, headers=headers, verify=False)
pprint(response.json()

I then tried to see if the URL would resolve in my browser expecting a 401 error since I didn't pass my token and got an SSL error there as well. I can't tell exactly if this error is with the acode python bindings, or more specifically with the halo.api.stdlib API itself. Any additional input would be appreciated.

SSL_Error

Update:
After additional poking and prodding, I cleared my cache and was able to get a 200 response using the gateway method using requests. But the Acode lib-python library still gives me a SSL wrong version error.

It seems to have only worked one time though, and is back to providing the SSL wrong version error again.

Activity

  1. jacoblee93 commented on Dec 16, 2021

    @jacoblee93

    Hi @mwishoff, thanks for reporting this.

    To help us debug, can you try accessing the API from the alternate URL https://infinite.halo.autocode.gg/stats/matches/retrieve/ in your browser and let me know what you see?

  2. mwishoff commented on Dec 16, 2021

    @mwishoff
    Author

    Hey Jacob, thanks for looking into this.

    I tried with the url you suggested and was able to get a 200 response!

    def requests_version2():
        url = 'https://infinite.halo.autocode.gg/stats/matches/retrieve/'
        params = {
            'id': '26829e9a-7fab-4c2b-ac28-a62360e55946',
            'Content-Type': 'application/json'
        }
        headers = {
            'Authorization': f'Bearer {dev_token}'
        }
        response = requests.get(url, params=params, headers=headers)
        print(response.status_code)
        print(response.url)

    200
    https://infinite.halo.autocode.gg/stats/matches/retrieve/?id=26829e9a-7fab-4c2b-ac28-a62360e55946&Content-Type=application%2Fjson

    I tried again with the code from this library as well, and the SSL wrong version number remained.

    def acode_lib():
        lib.__cfg__['token'] = f'{dev_token}'
        HaloAPI = lib.halo.infinite['@0.2.1']
        result = HaloAPI.stats.matches.list(gamertag='mop367')
        pprint(result)
  3. jacoblee93 commented on Dec 16, 2021

    @jacoblee93

    Gotcha, thanks for looking there. I'll continue investigating and will keep you updated :)

  4. jacoblee93 commented on Dec 22, 2021

    @jacoblee93

    Hey @mwishoff, I've made an update here - can you try again from the default api.stdlib.com domain?

  5. mwishoff commented on Dec 23, 2021

    @mwishoff
    Author

    Hey Jacob,

    I tried with both endpoints again.

    the acode_lib snippet above gives the unknown SSL error still:
    File "C:\Users\mwish\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
    ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:777)

    with this url I get a Verification Error again, but if I set verify to false in python I'm able to get a 200 response. https://infinite.halo.autocode.gg/stats/matches/retrieve/?id=26829e9a-7fab-4c2b-ac28-a62360e55946&Content-Type=application%2Fjson

    (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))

    Let me know if I can provide any more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions