Questions about Python requests

Asked 2 years ago, Updated 2 years ago, 40 views

I want to crawl the necessary information after logging into the school portal using the requests module.

It's my first time using a request

login ID off duty on the page and post - > a by post - > b, post - Get

the main page >.

When it is said that login takes place through the process, if you post your ID password at first, the latter part is automatically

Is it working? But I don't think I can log in.

crawling python

2022-09-21 11:15

1 Answers

Hi, how are you?

First of all, there is no information about the source code and the target homepage, so let me tell you a conceptual story.

The cookies that were first accessed and delivered must be included when the POST method is delivered through requests.post to receive the value later. In addition, you must be bound by one Session for a series of communications to receive the redirect page according to login completion.

Yes)

import requests
url = 'target.com/login.asp' #Loginactionpage
data = {'id': by 'howoni', 'pw', ':D'} #postmultipart/form-data
header = {'User-Agent': 'answer'} #html header
r = requests.session() #requestsession
r = requests.get('target.com') #Access target page
c = r.cookies.get_dict() #Importing cookie information in dictionary form for the target.
r = requests.post(url, data, headers=header, cookies=c) 
#Deliver post method including header and cookie
print(r.text) #text output for a page that is logged in and redirected

When checking login for Pentest purposes, write it based on the script as above. There is no accurate information in the question, so please refer to it even if it is not an accurate answer.


2022-09-21 11:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.