access `fetch()` with selenium!
Project description
selenium-fetch
A simple module that lets you access the fetch
API with selenium!
Why do I make this? just annoyed with cloudflare. It works best with undetected-chromedriver.
Installation
pip install selenium-fetch undetected-chromedriver
Example
from undetected_chromedriver import Chrome
from selenium_fetch import fetch, Options, get_browser_user_agent
LOGIN_PAGE_URL = "https://smekdong.com/login"
LOGIN_API_URL = "https://smekdong.com/api/login"
driver = Chrome(headless=False)
driver.get(LOGIN_PAGE_URL)
post_data = {
'username': 'blaabla',
'password': 'xxxx'
}
headers = {
"user-agent": get_browser_user_agent(driver),
'origin': 'https://smekdong.com',
'referer': 'https://smekdong.com/',
}
options = Options(method="POST", headers=headers, body=post_data)
response = fetch(driver, LOGIN_API_URL, options)
print("Response:", response)
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
selenium_fetch-0.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for selenium_fetch-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3a7a3ea45ed6d7b3c09be87cb39ce5a4ef0f302d872f24a43dbe218444ab24b |
|
MD5 | 8d54e4c5122b0276a8ec9672e3dd2d51 |
|
BLAKE2b-256 | 05be1c2678a2bb00b54dc5a25a528e3955f19478ba411d2e2b8d161ed1d823a3 |