I am trying to access http://forum.kriminala.net via Mechanize and parse my inbox messages.
From the html code, I can see that the login form is in the nested iframe of the main page:
<iframe src="login/" style="width: 100%; height: 124px; border-bottom: 2px solid #DDE5EA; box-shadow: 0px 0px 10px #ccc;" frameborder="0" vspace="0" scrolling="no" hspace="0">
...
<form action="" class="auth_form" method="post">
<input type="hidden" name="referer" value="http%3A%2F%2Fforum.kriminala.net%2F">
<input type="text" class="text_input" name="username" placeholder="Имя пользователя" value="" tabindex="1">
<input type="password" class="text_input" name="password" placeholder="Пароль" tabindex="2">
<input type="checkbox" id="autologin" checked="checked" name="autologin" tabindex="3">
<label for="autologin">Запомнить меня</label>
<input type="submit" class="submit_button" id="submit_button" name="login" value="" tabindex="3">
</form>
...
</iframe>
so I navigate to http://forum.kriminala.net/login, find the form there and submit it with my username and password, outputting the result in a file (to see if I got logged in successfully).
br=mechanize.Browser()
br.open("http://forum.kriminala.net/login/")
br.select_form(nr=0)
br["username"]="12n"
br["password"]="123456"
response=br.submit()
htmlpage=open("response.html","w")
htmlpage.writelines(response.get_data())
htmlpage.close()
However, all I see in the file is this:
<script type="text/javascript">
window.top.location = 'http://forum.kriminala.net/';
</script>
My next thought is maybe I should go to the main mage manually, so I open the main page in Mechanize, put it into an html file to open in a browser, but the file still looks like I am not logged in.
How do I deal with this?
P.S. I am a complete Python noob, so maybe I just don't know what to google to get my answers. If this is the case, please just point me in the right direction.
Thanks!