468,134 Members | 1,186 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,134 developers. It's quick & easy.

Python requests, login and monitoring webpage

1 Bit
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?
Mar 2 '21 #1
0 2974

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Fakhar | last post: by
4 posts views Thread by David Stockwell | last post: by
23 posts views Thread by anton.vredegoor | last post: by
1 post views Thread by Mahmoud Moussa via .NET 247 | last post: by
16 posts views Thread by John Salerno | last post: by
4 posts views Thread by cesar.ortiz | last post: by
2 posts views Thread by Mike | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.