Purpose To make a cloudflare challenge pass successfully, Can be use cf_clearance bypassed by cloudflare, However, with the cf_clearance, make sure you use the same IP and UA as when you got it.
Project description
cf_clearance
Reference from playwright_stealth and undetected-chromedriver
Purpose To make a cloudflare challenge pass successfully, Can be use cf_clearance bypassed by cloudflare, However, with the cf_clearance, make sure you use the same IP and UA as when you got it.
Warning
Please use interface mode, You must add headless=False.
If you use it on linux, use XVFB.
Install
$ pip install cf_clearance
Usage
sync
from playwright.sync_api import sync_playwright
from cf_clearance import sync_retry, stealth_sync
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
stealth_sync(page)
page.goto('https://nowsecure.nl')
res = sync_retry(page)
if res:
cppkies = page.context.cookies()
for cookie in cppkies:
if cookie.get('name') == 'cf_clearance':
print(cookie.get('value'))
ua = page.evaluate('() => {return navigator.userAgent}')
print(ua)
else:
print("fail")
browser.close()
async
import asyncio
from playwright.async_api import async_playwright
from cf_clearance import async_retry, stealth_async
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
await stealth_async(page)
await page.goto('https://nowsecure.nl')
res = await async_retry(page)
if res:
cppkies = await page.context.cookies()
for cookie in cppkies:
if cookie.get('name') == 'cf_clearance':
print(cookie.get('value'))
ua = await page.evaluate('() => {return navigator.userAgent}')
print(ua)
else:
print("fail")
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cf_clearance-0.0.1.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for cf_clearance-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 121591a98a194ccb986c035bd0d88ee5bdcbaa23d7845f71bd8aaef17a069aa1 |
|
MD5 | 4ec2e5dfbcdd1a4bcc8fb0eebadedbca |
|
BLAKE2b-256 | 1cee5da39cd6ce9840772c70352429d5494d5ced7c1928df723fec73cca47f41 |