Im trying to write script that login to website using requests lib and then monitor some informations.
Code here:
import requests
POST_LOGIN_URL = 'https://app.distill.io/login'
REQUEST_URL = 'https://app.distill.io/watchlist#inbox'
payload = {
'name': 'username',
'password': 'pass'
}
h = {
'authority': 'app.distill.io',
'method': 'GET',
'path': '/login',
'scheme': 'https',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'pl-PL,pl;q=0.9',
'cookie': '__cfduid=d4fcc01d84b19b2af972fdbaaaeb90a751614605 087; sid=s%3AI8hTX2h-w7Wn6cVurn8pkZ05.tRh5gkrZouW9vK60sO9JOExLmHrsdNgI0 yNFeqDDr%2Fs',
'referer': 'https://app.distill.io/watchlist#inbox',
'sec-fetch-dest': 'document',
'sec-fetch-mode': 'navigate',
'sec-fetch-site': 'same-origin',
'sec-fetch-user': '?1',
'sec-gpc': '1',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36',
}
session = requests.session()
p = requests.post(POST_LOGIN_URL, data=payload, headers=h)
print(p.status_code) # it returns status code 200
r = session.get(REQUEST_URL)
print(r.text)
It seems to login succesfully, but when I'm trying to get text from REQUEST_URL it returns random signs. Am I doing something wrong?