SSL Error when using gdown downloading from Google Drive - python

I want to download some large files to my server directly from Google Drive. So I learned the methods of gdown from the post here:
wget/curl large file from google drive
I already make sure those files are shared and Anyone with the shareable link can view. I copied the shareable link https://drive.google.com/open?id=1pO3NuUIkCF3-ZvUVI6JcI-BDe9gzCkX3 and changed to .
The command I run was:
gdown https://drive.google.com/uc?id=1GwPudL00Im8yi-jJepPS6SKXn4sxvvT9
Still I get an error regarding the OPENSSL.
The detailed error log is pasted below:
Traceback (most recent call last):
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 472, in wrap_socket
cnx.do_handshake()
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1915, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1639, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (104, 'ECONNRESET')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 344, in _make_request
self._validate_conn(conn)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 843, in _validate_conn
conn.connect()
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 370, in connect
ssl_context=context)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 355, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 478, in wrap_socket
raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: SysCallError(104, 'ECONNRESET')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 399, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='drive.google.com', port=443): Max retries exceeded with url: /uc?id=1pO3NuUIkCF3-ZvUVI6JcI-BDe9gzCkX3 (Caused by SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')",),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yangyxt/anaconda3/bin/gdown", line 10, in <module>
sys.exit(main())
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/gdown/cli.py", line 100, in main
speed=args.speed,
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/gdown/download.py", line 77, in download
res = sess.get(url, stream=True)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/yangyxt/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='drive.google.com', port=443): Max retries exceeded with url: /uc?id=1pO3NuUIkCF3-ZvUVI6JcI-BDe9gzCkX3 (Caused by SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')",),))

Related

requests.exceptions.SSLError: HTTPSConnectionPool How can I solve it?

I got error:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\connection.py", line 364, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\connection.py", line 501, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1070, in _create
self.do_handshake()
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ipinfo.io', port=443): Max retries exceeded with url: /json (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\PythonLesson\text.py", line 7, in <module>
response = requests.get('https://ipinfo.io/json', proxies=proxies)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\user\PycharmProjects\PythonLesson\venv\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='ipinfo.io', port=443): Max retries exceeded with url: /json (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)')))
Process finished with exit code 1
Do I need to download any pip SSL? Or is it because of a proxy problem? Or add a pip to IDE like "Pycharm"?
I get every time error even when I change a proxy.
my code:
import requests
proxies = {
'https': 'https://150.129.148.99:35101'
}
response = requests.get('https://ipinfo.io/json', proxies=proxies)
print(response.json()['country'])
print(response.json()['region'])
This is a video https://www.youtube.com/watch?v=nnIye9pM22w in min 5:21 that I copied his code, and just for him it works and for me it does not
It's definitely a problem with proxy.
You can check it with curl like this:
curl -v -x https://150.129.148.99:35101 ipinfo.io
You'll have:
* Trying 150.129.148.99...
* TCP_NODELAY set
And nothing more. That means the proxy server doesn't respond correctly.

How to add proxy to quickstart.py-python

I execute quickstart.py according to the steps of the tutorial, and he will report an error. I'm pretty sure it has something to do with the proxy in my place, so I especially want to know how to add my proxy to quickstart.py and how to add it is correct. The error message is as follows, hope to answer, thank you!
Traceback (most recent call last):
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "D:\Python\lib\site-packages\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "D:\Python\lib\site-packages\urllib3\connection.py", line 506, in _connect_tls_proxy
ssl_context=ssl_context,
File "D:\Python\lib\site-packages\urllib3\util\ssl_.py", line 450, in ssl_wrap_socket
sock, context, tls_in_tls, server_hostname=server_hostname
File "D:\Python\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "D:\Python\lib\ssl.py", line 423, in wrap_socket
session=session
File "D:\Python\lib\ssl.py", line 870, in _create
self.do_handshake()
File "D:\Python\lib\ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Python\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "D:\Python\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/2021-0/Project/eliis_arno/RpaChangeOrder/test/quickstart.py", line 47, in <module>
main()
File "D:/2021-0/Project/eliis_arno/RpaChangeOrder/test/quickstart.py", line 28, in main
creds = flow.run_local_server(port=0)
File "D:\Python\lib\site-packages\google_auth_oauthlib\flow.py", line 479, in run_local_server
self.fetch_token(authorization_response=authorization_response)
File "D:\Python\lib\site-packages\google_auth_oauthlib\flow.py", line 288, in fetch_token
return self.oauth2session.fetch_token(self.client_config["token_uri"], **kwargs)
File "D:\Python\lib\site-packages\requests_oauthlib\oauth2_session.py", line 344, in fetch_token
**request_kwargs
File "D:\Python\lib\site-packages\requests_oauthlib\oauth2_session.py", line 516, in request
method, url, headers=headers, data=data, **kwargs
File "D:\Python\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "D:\Python\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "D:\Python\lib\site-packages\requests\adapters.py", line 510, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))

Problem downloading website with Python Requests.get() method on a AWS Ubuntu EC2 instance

I have a webscraping project that is stuck.
I am using the Requests package and the get() method to download the website http, after which I want to use Beautiful Soup on it.
It works fine on my labtop, but when I upload the program to my AWS Ubuntu EC2 instance, I run into an error. I have tried other websites, and they all work, I only run into these problems with this site.
Does anyone know why this is happening?
Based on the error messages, I suspected SSL issues, but even with the verify=False parameter, it still wont work.
The code:
import requests
url = "http://www.kino.dk"
r = requests.get(url, verify=False)
print(r.text)
The error message:
> Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
cnx.do_handshake()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1915, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl_error
_raise_current_error()
File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls12_check_peer_sigalg', 'wrong signature type')]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 996, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 352, in connect
self.sock = ssl_wrap_socket(
File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket
raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls12_check_peer_sigalg', 'wrong signature type')])",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 719, in urlopen
retries = retries.increment(
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.kino.dk', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls12_check_peer_sigalg', 'wrong signature type')])")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 6, in <module>
response = requests.get(url, verify=False)
File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 668, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 668, in <listcomp>
history = [resp for resp in gen] if allow_redirects else []
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 239, in resolve_redirects
resp = self.send(
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.kino.dk', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls12_check_peer_sigalg', 'wrong signature type')])")))

Unable To Get HTTPS URLs (requests package)

When I try to follow the guide here: https://automatetheboringstuff.com/chapter11/ my script fails:
import requests
res = requests.get('https://automatetheboringstuff.com/files/rj.txt')
type(res)
res.raise_for_status()
requests is installed.
I am given the following error messages after a very long wait, which only appear when using HTTPS URLs; the same thing occurs on two Windows 10 64bit machines with Python 3.6.3 64bit and Python 3.6.4 64bit:
"C:\Program Files\Python36\python.exe" "C:/Users/user.name/Google Drive/Automation/RoHSWebScraper/main.py"
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 441, in wrap_socket
cnx.do_handshake()
File "C:\Program Files\Python36\lib\site-packages\OpenSSL\SSL.py", line 1716, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "C:\Program Files\Python36\lib\site-packages\OpenSSL\SSL.py", line 1449, in _raise_ssl_error
raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Program Files\Python36\lib\site-packages\urllib3\connection.py", line 326, in connect
ssl_context=context)
File "C:\Program Files\Python36\lib\site-packages\urllib3\util\ssl_.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Program Files\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 448, in wrap_socket
raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Program Files\Python36\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='automatetheboringstuff.com', port=443): Max retries exceeded with url: /files/rj.txt (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/user.name/Google Drive/Automation/RoHSWebScraper/main.py", line 3, in <module>
res = requests.get('https://automatetheboringstuff.com/files/rj.txt', verify=False)
File "C:\Program Files\Python36\lib\site-packages\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Program Files\Python36\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Program Files\Python36\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files\Python36\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files\Python36\lib\site-packages\requests\adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='automatetheboringstuff.com', port=443): Max retries exceeded with url: /files/rj.txt (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))
Process finished with exit code 1
Can anyone help me with this infuriating problem!!?
You can try urllib:
Python2:
import urllib
data = urllib.urlopen('https://automatetheboringstuff.com/files/rj.txt').read()
Python3:
import urllib.requests
data = urllib.requests.urlopen('https://automatetheboringstuff.com/files/rj.txt').read()
So it turns out the computers on my corporate network are using proxy servers, which was preventing my HTTP and HTTPS requests from connecting properly.
I followed the answer from Lelouchzqy here to determine what my HTTP and HTTPS proxy servers were.
I then followed the answer from Roland Smith here to tell requests which proxies to use.
Hopefully this will help someone in the future if they have the same issue!

SSL Error when using local cert to verify

Error Message Data
Traceback (most recent call last):
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\util\ssl_.py", line 313, in ssl_wrap_socket
context.load_verify_locations(ca_certs, ca_cert_dir)
ssl.SSLError: unknown error (_ssl.c:3510)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connection.py", line 326, in connect
ssl_context=context)
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\util\ssl_.py", line 315, in ssl_wrap_socket
raise SSLError(e)
urllib3.exceptions.SSLError: unknown error (_ssl.c:3510)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='controlpanel.peopleadmin.com', port=443): Max retries exceeded with url: /sessions/ (Caused by SSLError(SSLError(0, 'unknown error (_ssl.c:3510)'),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/cody.jones/PycharmProjects/loginhandler/test.py", line 48, in <module>
response = ses.post(url, values, verify='cert.cer')
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\sessions.py", line 555, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\cody.jones\AppData\Local\Programs\Python\Python36-32\lib\site-packages\requests\adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='controlpanel.peopleadmin.com', port=443): Max retries exceeded with url: /sessions/ (Caused by SSLError(SSLError(0, 'unknown error (_ssl.c:3510)'),))
My code
values = {'system_user[username]' : username,
'system_user[password]' : password,
'authenticity_token' : token }
#begin session
ses = requests.Session()
response = ses.post(url, values, verify='cert.cer')
I have copied the SSL cert by downloading the data with openSSL. However I'm still getting a ton of errors from this and I don't see what I could be doing wrong. I'm trying to resolve the issues with SSL because when I connect with my script over my VPN (instead of being in the actual office) it has an issue with its SSL verification. I need this software to work regardless of whether or not you're over a VPN since I'm usually on a VPN.

Categories

Resources