Sep-23-2020, 09:42 AM
In general i think you need to use Selenium for heavy JavaScript sites like this.
Usually cookies send automatically in a session.
Here something i have done before.
Selenium is the easiest way,or need to really look into how site work and maybe catch Json/Ajax response.
Usually cookies send automatically in a session.
Here something i have done before.
import requests from bs4 import BeautifulSoup headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36' } login_data = { 'email':'[email protected]', 'password':'mypasswordexample', 'onlyLogin':'true' } with requests.Session() as s: s.post('https://www.zalando-lounge.com/#/login', headers=headers, params=login_data) # logged in! session cookies saved for future requests # print(s.cookies) # Test response = s.get('Url inside') # cookies sent automatically! soup = BeautifulSoup(response.content, 'lxml') welcome = soup.find('something inside') print(welcome)So even the message that that combination username and password doesn't match,is done bye JavaScript in this case React.
Selenium is the easiest way,or need to really look into how site work and maybe catch Json/Ajax response.