Код: Выделить всё
import requests
from bs4 import BeautifulSoup
#This URL will be the URL that your login form points to with the "action" tag.
POST_LOGIN_URL = 'https://example.com/login/'
#This URL is the page you actually want to pull down with requests.
REQUEST_URL = 'https://example/client/?id=R_111
payload = {
'username': 'username',
'pass': 'pass'
}
_headers = {
"user-agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36',
"_ga":"GA1.1.2090868915.1717658789",
"_ym_uid":"1717658790316065116",
"_ym_d":"1717658790",
"_ga_1DG8M1CXDE":"GS1.1.1717658789.1.0.1717658795.0.0.0"
}
with requests.Session() as session:
post = session.post(POST_LOGIN_URL, data=payload, headers=_headers)
r = session.get(REQUEST_URL)
print(r.text) #or whatever else you want to do with the request data!
Код: Выделить всё
Email address
Password
Keep Me Logged In
Log In ›
Подробнее здесь: https://stackoverflow.com/questions/793 ... -redirects
Мобильная версия