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

ImportError: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' #467

Open
CureSaba opened this issue Jul 21, 2024 · 3 comments
Open
Labels

Comments

@CureSaba
Copy link

Before creating an issue, first upgrade cfscrape with pip install -U cfscrape and see if you're still experiencing the problem. Please also confirm your Node version (node --version or nodejs --version) is version 10 or higher.

Make sure the website you're having issues with is actually using anti-bot protection by Cloudflare and not a competitor like Imperva Incapsula or Sucuri. And if you're using an anonymizing proxy, a VPN, or Tor, Cloudflare often flags those IPs and may block you or present you with a captcha as a result.

Please confirm the following statements and check the boxes before creating an issue:

  • [x ] I've upgraded cfscrape with pip install -U cfscrape
  • [x ] I'm using Node version 10 or higher
  • [x ] The site protection I'm having issues with is from Cloudflare
  • [x ] I'm not using Tor, a VPN, or an anonymizing proxy

Python version number

Run python --version and paste the output below:

Python 3.12.1

cfscrape version number

Run pip show cfscrape and paste the output below:

Name: cfscrape
Version: 2.1.1
Summary: A simple Python module to bypass Cloudflare's anti-bot page. See https://github.com/Anorov/cloudflare-scrape for more information.
Home-page: https://github.com/Anorov/cloudflare-scrape
Author: Anorov
Author-email: [email protected]
License: UNKNOWN
Location: C:\Users\CureSaba\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: requests
Required-by:

Code snippet involved with the issue

from urllib3.util.ssl_ import create_urllib3_context, DEFAULT_CIPHERS

Complete exception and traceback

(If the problem doesn't involve an exception being raised, leave this blank)

Traceback (most recent call last):
  File "c:\Users\CureSaba\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\CureSaba\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "c:\Users\CureSaba\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>       
    cli.main()
  File "c:\Users\CureSaba\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
    run()
  File "c:\Users\CureSaba\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\Users\CureSaba\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\CureSaba\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code       
    _run_code(code, mod_globals, init_globals,
  File "c:\Users\CureSaba\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "C:\Users\CureSaba\Downloads\a\test.py", line 1, in <module>
    import cfscrape
  File "c:\Users\CureSaba\AppData\Local\Programs\Python\Python312\Lib\site-packages\cfscrape\__init__.py", line 19, in <module>
    from urllib3.util.ssl_ import create_urllib3_context, DEFAULT_CIPHERS
ImportError: cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (c:\Users\CureSaba\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\ssl_.py)

URL of the Cloudflare-protected page

[https://twivideo.net/?ranking]

URL of Pastebin/Gist with HTML source of protected page

[https://twivideo.net/?ranking]

@CureSaba CureSaba added the bug label Jul 21, 2024
@chriss2401
Copy link

Any solutions here ? I am also having the same issue.

@yieldcurvemonkey
Copy link

try downgrading urllib3

pip install urllib3==1.26.16

@rianaditro
Copy link

pip install urllib3==1.26.16

It does remove the problem but unfortunately cant bypass cloudflare protection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants