Looking at various reference articles (Qiita login etc.), for the login page
payload = {
'userid': 'my_id',
'password': 'my_pass'
}
s = requests.Session()
p = s.post(login_url, data=payload)
r = s.get(want_to_access_url)
It's been processed like this, and it works! I heard that, but for some reason I can't log in to the page I wanted to log in to ...
If I try it with excite mail, it works ...
If you read the source code carefully, you will see the upper part of the login form.
<form action="/login/login/" method="post">
There was such a code.
** What is action attribute **? -It must be specified in the attribute specified in the form tag. -Press the submit button of the form and specify the destination of the data to be submitted ・ The destination of data is called URI -Specify the URI of the CGI program of the server that handles the data transfer process.
So ** Just rewrite the end of the URL to the action path! ?? ** **
add-action-path
failed_url = 'https://ssl.syosetu.com/login/input/' #URL displayed when accessed from a browser
success_url = 'https://ssl.syosetu.com/login/login/' #URL where you can log in successfully
I tried it and it worked well with Don Pisha.
I have to study the WEB ... Sweat
If you think "Oh? I can't log in! Why!", Please try it!
Recommended Posts