W
W
Web__Nikita032019-03-10 17:16:55
Python
Web__Nikita03, 2019-03-10 17:16:55

How to make authorization through python?

I want to parse this site https://freelance.ru/notification/folder/15/7 . For an authorized user, a similar picture pops up For an unauthorized user
5c851b1831d1f438374011.png
How
5c851bd386706031193269.png
can I log in to the site?
Here is my code

import requests


def for_free_acc():
    pass

def parse_f():
    headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'}
    data = {
        'login': '[email protected]',
        'password': 'Ni20'
    }
    base_url = 'https://freelance.ru/notification/folder/15/7'
    session = requests.Session()
    answer = session.get(base_url, headers=headers, data=data)
    print(answer.text)

parse_f()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yaroslav, 2019-03-11
@Web__Nikita03

1. You need to log in once, and then work with the same session (and not send a login-password for each request). Log in - on a page like /login (look in the browser how the site does), it makes no sense to send a login-password to the wrong page.
2. Authorization, if properly done, is done via an HTTP POST request (not a GET).

D
Dimonchik, 2019-03-10
@dimonchik2013

show the code where you do the authorization

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question