G
G
GLEF1X2020-11-07 12:52:11
Python
GLEF1X, 2020-11-07 12:52:11

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)

Of course, it didn’t work out for me, the site https://hotline.ua/login/ . Maybe someone knows how to competently enter this site and what in general you can read about authorizations, cookies and so on ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-11-07
@SoreMix

F12 - Network
Enter your login and password, click on the authorization button. See what request went -> repeat this request in python

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question