Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Errors #5

Open
mwishoff opened this issue Dec 15, 2021 · 5 comments
Open

SSL Errors #5

mwishoff opened this issue Dec 15, 2021 · 5 comments

Comments

@mwishoff
Copy link

mwishoff commented Dec 15, 2021

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/[email protected]/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.

@jacoblee93
Copy link

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?

@mwishoff
Copy link
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)

@jacoblee93
Copy link

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

@jacoblee93
Copy link

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

@mwishoff
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants