473,320 Members | 2,000 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 3399

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

Similar topics

3
by: Fakhar | last post by:
Hi All, How can I check fake requests on my webpage. I am asking for email address as input and I wounder if anyone write a program to send fake requests and my system will be busy to respond...
4
by: David Stockwell | last post by:
Hi, In java/jsp I can pass parameters to my python script on a webpage by doing something like this: http://somewhere.org/mypage.jsp?parm1=something&parm2=another How do I do that with...
23
by: anton.vredegoor | last post by:
Here's my situation: I'm typing this in a public library on a computer with OS windows 2000 server. I can run Internet explorer, word, excel and powerpoint, that's it. Maybe java, but it seems...
1
by: Mahmoud Moussa via .NET 247 | last post by:
I do have a Strange Problem When I login to my Site and Do Some work .. When I Click a Button to open a new window the New Window Reuests me to relogin even when I'm Already logged on the Parent ...
16
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of...
4
by: cesar.ortiz | last post by:
Hi, I am starting to have a look to a python program that does not free memory (I am using python 2.4.3). As I have read about a new memory management in python 2.5...
4
by: CM | last post by:
I encounter a fair number of small Python scripts online, and usually try them out by copying them to the clipboard, pasting into Notepad, saving them, and either running them directly or opening...
2
by: Mike | last post by:
Hi, I'm writing client-server application in Python. It's monitoring system, where server listen and waits for TCP connections, and every connection takes own thread. Every thread puts data from...
3
by: Mohed | last post by:
Hello. I am interrested in seeing the source code for all the nativ builtin methods and clases in python. Is there a webpage that lists them or is this done easier some other way. This is my...
6
by: mott3510 | last post by:
I wrote a python script and when I run it, it outputs what I want, so I know that it is working. Now I want to be able to put the output of the code on my website and I have no idea how to do this,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.