in Education by
I'm scraping some internal pages using Python and requests. I've turned off SSL verifications and warnings. requests.packages.urllib3.disable_warnings() page = requests.get(url, verify=False) On certain servers I receive an SSL error I can't get past. Traceback (most recent call last): File "scraper.py", line 6, in page = requests.get(url, verify=False) File "/cygdrive/c/Users/jfeocco/VirtualEnv/scraping/lib/python3.4/site-packages/requests/api.py", line 71, in get return request('get', url, params=params, **kwargs) File "/cygdrive/c/Users/jfeocco/VirtualEnv/scraping/lib/python3.4/site-packages/requests/api.py", line 57, in request return session.request(method=method, url=url, **kwargs) File "/cygdrive/c/Users/jfeocco/VirtualEnv/scraping/lib/python3.4/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/cygdrive/c/Users/jfeocco/VirtualEnv/scraping/lib/python3.4/site-packages/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "/cygdrive/c/Users/jfeocco/VirtualEnv/scraping/lib/python3.4/site-packages/requests/adapters.py", line 477, in send raise SSLError(e, request=request) requests.exceptions.SSLError: [SSL: SSL_NEGATIVE_LENGTH] dh key too small (_ssl.c:600) This happens both in/out of Cygwin, in Windows and OSX. My research hinted at outdated OpenSSL on the server. I'm looking for a fix client side ideally. Edit: I was able to resolve this by using a cipher set import requests requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += 'HIGH:!DH:!aNULL' try: requests.packages.urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST += 'HIGH:!DH:!aNULL' except AttributeError: # no pyopenssl support used / needed / available pass page = requests.get(url, verify=False) JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
this is not an extra answer just try to combine the solution code from question with extra information So others can copy it directly without extra try It is not only a DH Key issues in server side, but also lots of different libraries are mismatched in python modules. Code segment below is used to ignore those securitry issues because it may be not able be solved in server side. For example if it is internal legacy server, no one wants to update it. Besides the hacked string for 'HIGH:!DH:!aNULL', urllib3 module can be imported to disable the warning if it has import requests import urllib3 requests.packages.urllib3.disable_warnings() requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL' try: requests.packages.urllib3.contrib.pyopenssl.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL' except AttributeError: # no pyopenssl support used / needed / available pass page = requests.get(url, verify=False)

Related questions

0 votes
    I have a python script that uses the VirusTotal API. It has been working with no problems, but all ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 8, 2022 in Education by JackTerrance
0 votes
    What is the problem Here ? I got an error shows ValueError: too many values to unpack This code ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    What's the proper way to declare custom exception classes in modern Python? My primary goal is to follow whatever ... is it necessary? Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    Functional programming language cannot be an object oriented language too 1. True 2. False...
asked Mar 7, 2023 in Technology by JackTerrance
0 votes
    Susan is so beautiful; I bet she is smart too. This is an example of __________ (a) The halo effect (b) ... prophecy (d) The recency effect Please answer the above question....
asked Oct 22, 2022 in Education by JackTerrance
0 votes
    I don't need so many pins , they are crowding the area. I used the output of kml parser to draw ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I wait for onCharacteristicChanged() callbacks to receive data via BLE. But if the BluetoothDevice sends too ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    In a script where I create many figures with fix, ax = plt.subplots(...), I get the warning ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    just wondering what it is. Edit: I know it's not a type of array but just a feature. So what ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    just wondering what it is. Edit: I know it's not a type of array but just a feature. So what ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    what configuration needs to be tweaked, and where does it live, in order to increase the maximum allowed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    what configuration needs to be tweaked, and where does it live, in order to increase the maximum allowed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Using classic templates, publishing via FTP to a custom domain. I want to add custom elements such as: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
0 votes
    Columns can be arranged in descending order too by using the special ____ operator. (a) asc() (b) desc( ... Operations of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    I am creating a WPF Application that uses Fluent library. On my computer with Windows 7, 2GB RAM and ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
...