I'm trying to get a website's source data after logging in but am having trouble logging in to get to the source. The url is the webpage I see after logging in. I.e. if I login on chrome, I can use url to go to where I need to get the source data.
I keep getting multiple errors, primarily handshake errors:
"sslv3 alert handshake failure", "bad handshake", "urllib3.exceptions.MaxRetryError", and I think the primary error is
Traceback (most recent call last): File "C:\Users\bwayne\AppData\Local\Programs\Python\Python36-32\lib\site-packages\urllib3\contrib\pyopenssl.py", line 441, in wrap_socket cnx.do_handshake()
File "C:\Users\bwayne\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenSSL\SSL.py", line 1716, in do_handshake self._raise_ssl_error(self._ssl, result)
File "C:\Users\bwayne\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenSSL\SSL.py", line 1456, in _raise_ssl_error _raise_current_error()
File "C:\Users\bwayne\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenSSL_util.py", line 54, in exception_from_error_queue raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_read_bytes', 'sslv3 alert handshake failure')]
During handling of the above exception, another exception occurred:
import requests, sys
import ssl
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
ctx.options |= ssl.OP_NO_SSLv2
ctx.options |= ssl.OP_NO_SSLv3
ctx.options |= ssl.OP_NO_TLSv1
ctx.options |= ssl.OP_NO_TLSv1_1
class Ssl3HttpAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=False):
self.poolmanager = PoolManager(num_pools=connections,
maxsize=maxsize,
block=block,
ssl_version=ssl.PROTOCOL_TLSv1)
url = "www.thewebsite.com"
def do_requests(url):
payload = {'Username': 'myName', 'Password': 'myPass'}
headers = {'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Mobile Safari/537.36'}
with requests.Session() as s:
s.mount(url,Ssl3HttpAdapter())
p = s.post(url, headers=headers, data=payload, verify=False)
def main(url):
do_requests(url)
main(url)
How can I login? I've double and triple checked that the HTML names are correct:
