python get html page after login
Question: I want to login to famjia.com and i try all the methods, none of them works
for me. I tried using requests and urllib but they don't work. Help? These is
my code. Thanks in advance. import requests

    
    
    URL = 'http://www.famjia.com/portal/intranet/famjiaPaper/'
    
    session = requests.session()
    
    login_data = dict({'initialURI':'/portal/intranet/',
                               'loginname':'loginname',
                               'loginpassword':'loginpassword',
                               'username':'username',
                               'password':'password',
    
                              })
    r = session.post(URL, data=login_data)
    
    req = session.get('http://www.famjia.com/portal/intranet/famjiaPaper/')
    
    print req.content
    


Answer: The `POST` request should be made to `http://www.famjia.com/portal/login` url:

    
    
    import requests
    
    URL = 'http://www.famjia.com/portal/intranet/famjiaPaper/'
    LOGIN_URL = 'http://www.famjia.com/portal/login'
    
    session = requests.session()
    
    login_data = {'initialURI': '/portal',
                  'loginname': '',
                  'loginpassword': '',
                  'username': 'YOUR USERNAME HERE',
                  'password': 'YOUR PASSWORD HERE'}
    session.post(LOGIN_URL, data=login_data)
    
    req = session.get(URL)
    print req.content
    

