python-amazon-mws/python-amazon-mws

[Bug]: SSL Error with Python Version 3.9 and 3.10

iconberg opened this issue · 3 comments

Python Version

3.9

Python Amazon MWS (PAM) Version

1.0dev (GitHub develop branch)

Has your copy of PAM been altered in any way?

No, I HAVE NOT made changes to the MWS code

Describe the issue

Our code ist working with 3.8,
but try using newer versions like 3.9 and 3.10 we got this errors:

Traceback (most recent call last): File "C:\Temp\amazon_orders2\amazon_orders.py", line 426, in <module> service_status = orders_api.get_service_status() File "C:\Users\re\AppData\Local\Programs\Python\Python39-32\lib\site-packages\mws\mws.py", line 351, in get_service_status return self.make_request(extra_data=dict(Action='GetServiceStatus')) File "C:\Users\re\AppData\Local\Programs\Python\Python39-32\lib\site-packages\mws\mws.py", line 306, in make_request response = request(method, url, data=kwargs.get( File "C:\Users\re\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "C:\Users\re\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "C:\Users\re\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "C:\Users\re\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\adapters.py", line 510, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='mws-eu.amazonservices.com', port=443): Max retries exceeded with url: /Orders/2013-09-01?AWSAccessKeyId=xxxxxxxxxxxxxxxxxxxxxxxxxx&Action=GetServiceStatus&SellerId=xxxxxxxxxxxxxxxxxxxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2022-10-27T09%3A47%3A02&Version=2013-09-01&Signature=xxxxxxxxxxxxxxxxxxxxxxx (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)'))))

Is there a solution for this?

sincerly

MWS Credential check

  • I have removed my MWS credentials from any tracebacks and code samples

Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy

I'm also seeing this being the root cause in this SO response.

Can you check the values you're using for HTTP_PROXY and HTTPS_PROXY in your environment? Or anywhere else you might be setting them?

What version of urllib is in your different python versions. It looks like from urllib 1.26> the proxy needs to have the correct schema defined (http https etc)

@GriceTurrble answer is most likely correct to solve this - but the reason is this tiny shift from 1.26 onwards

https://github.com/urllib3/urllib3/blob/main/CHANGES.rst

Closing as inactive. Thank you.