简体   繁体   中英

Why can't I login to this site using the Requests module?

I'm trying to make an API for a pastebin/file upload site. The problem is, I can't seem to login to an account so I can add support for authorized pastes/uploads. This is the website.

Here's what I have so far. I do not know why it's not working.

import requests

sess = requests.Session()
sess.post('http://sharefa.st/login', data={'username': username, 'password': password, 'remember_me': 'true', 'login': 'Sign In'})

print sess.get('http://sharefa.st/vault').text #secret page for logged-in people.

If you first try to print the status code, you can see what is going on:

print sess.status_code

The list of possible codes is here and the requests documentation is here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM