Answer the question
In order to leave comments, you need to log in
How to login to website using python and session?
Hello.
I'm learning python and decided to try to log in to the site. There is no background in web technologies, and I don’t know how this process happens.
When you just needed to take something from the page - used session
def login(url, session):
headers = {
'User-Agent': ua.random
}
datas = {
'login': '',
'password': ''
}
response = session.post(url, headers=headers, data=datas)
print(response.url)
html = session.get('https://hotline.ua/profile/708886228/loyalty/', headers=headers)
#print(html.text)
def get_session():
with requests.session() as session:
login('https://hotline.ua/login/', session)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question