Answer the question
In order to leave comments, you need to log in
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
How
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
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).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question