Sunday 15 January 2012

html - How to login in a website using POST in Python? -



html - How to login in a website using POST in Python? -

i automatically fill form in website using website. content after form below processed. read topics (1, 2, 3) related it, i'm bit confused fields necessary send , how send them. form fictitious url:http://fix-tt.mary.com/tmtrack/tmtrack.dll

<form name="login" id="login" method="post"> <input name="tmbnx" type="hidden" value="iso-8859-1"> <input name="postpreservationdata" type="hidden" value=""> <input name="target" type="hidden" value="http%3a%2f%2ffix-tt.mary.com%2ftmtrack%2ftmtrack.dll%3fpage%26id%3d4245024%26template%3dviewwrapper%26tableid%3d1003"> <input name="smauthreason" type="hidden" value="0"> <input name="smtryno" type="hidden" value=""> <input name="smretries" type="hidden" value="1"> <input name="bacmonitoring" type="hidden" value="log on"> <h3>use email address</h3> <label>email address:</label> <input name="user" type="text"> <div class="email-login-help clearfix"> <span class="help">format: user@test.com</span> </div> <br> <label>computer password:</label> <input name="password" class="computer-pass text" onpaste="return false" type="password" autocomplete="off"> <div class="submit-row"><input class="btn btn-primary" onclick="javascript:trimandsubmit();" type="submit" value="log on"> </div> <br> </form>

any thought how ?

if want in python utilize requests library:

http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests

import requests payload = {'user': 'user@email.com', 'password': 'password123', 'tmbnx': 'iso-8859-1', 'smauthreason': 0, 'smretries': 1, 'bacmonitoring': 'log on', 'target': 'http://fix-tt.mary.com/tmtrack/tmtrack.dll', } r = requests.post("http://path-to-login-page.com", data=payload) print(r.text)

the above code guess @ fields might required, username , password required. guess based on fields had default parameters specified. should start though.

python html django url

No comments:

Post a Comment