samedi 4 novembre 2017

Login into a website with python and get content

I'm trying to use python to login in this website, but when I try to print I get the login page code again. I removed the username and password for safety reasons

import requests
import sys

username = ''
password = ''

URL = 'http://webgiz.uemg.br/'

def main():
    session = requests.session()
    login_data = {
        'username': username,
        'passwd': password,
        'btnlogin': 'login',
    }

    r = session.post(URL, data=login_data)
    r = session.get('http://ift.tt/2A7XWfH')
    print r.content

if __name__ == '__main__':
    main()




Aucun commentaire:

Enregistrer un commentaire