Thread View: pl.comp.lang.python
3 messages
3 total messages
Started by Adam Mikuta
Tue, 25 Aug 2009 09:01
mechanize, problem z form
Author: Adam Mikuta
Date: Tue, 25 Aug 2009 09:01
Date: Tue, 25 Aug 2009 09:01
52 lines
2985 bytes
2985 bytes
Mam mały problem z mechanize. Nie bardzo rozumiem czemu po wybraniu
formy nie ma w niej imputów. Brakuje email i password. Przy próbie ich
ustawienia (b.form['email'] = 'email') dostaję błąd:
ClientForm.ControlNotFoundError: no control matching name 'email'
Trochę kodu żeby rozjaśnić sytuację:
>>> import mechanize
>>> b = mechanize.Browser()
>>> r = b.open('https://polarpersonaltrainer.com')
>>> b.select_form('login')
>>> print b.form
<login POST https://polarpersonaltrainer.com/index.ftl application/x-www-form-urlencoded
<SubmitControl(_submit=submit) (readonly)>
<HiddenControl(.action=login) (readonly)>
<HiddenControl(tz=0) (readonly)>>
>>>
r.read():
[...]
<form name="login" action="index.ftl" method="post" id="loginform">
<div id="loginFields">
<div>
Username (email)<br/>^
<input name="email" id="email" value="" size="30" />
</div>
<div>
Password<br/>
<input type="password" name="password" value="" size="30" />
</div>
<div id="lowerFields">
<a href="" class="loginButton" id="submit" onclick="PPT.submit(this, 'login');return false;">Log in! ></a>
<input type="submit" name="_submit" value="submit" class="hiddenButton" />
<input type="hidden" name=".action" value="login"/>
<br/>
<a href="https://www.polarpersonaltrainer.com/forgot.ftl">Have you forgotten your password?</a><br/>
<a href="https://www.polarpersonaltrainer.com/register/">Register</a>
</div>
<input type="hidden" name="tz" value="0" id="tz"/>
<script type="text/javascript">
$('tz').setValue(new Date().getTimezoneOffset());
</script>
</div>
</form>
[...]
Zetknął się z tym ktoś?
--
Adam "Prawda jest prosta - gdyby było inaczej
każdy głupiec mógłby ją zrozumieć".
Re: mechanize, problem z form
Author: Barti
Date: Wed, 26 Aug 2009 09:56
Date: Wed, 26 Aug 2009 09:56
11 lines
1310 bytes
1310 bytes
Dnia Tue, 25 Aug 2009 09:01:24 +0000 (UTC), Adam Mikuta napisał(a): > Mam mały problem z mechanize. Nie bardzo rozumiem czemu po wybraniu > formy nie ma w niej imputów. Brakuje email i password. Przy próbie ich > ustawienia (b.form['email'] = 'email') dostaję błąd: > [...] > > Zetknął się z tym ktoś? Tak, wszystko już było: ;) http://groups.google.com/group/pl.comp.lang.python/browse_thread/thread/b414efccd5922cc0/e7b869b29f2c594c
Re: mechanize, problem z form
Author: Adam Mikuta
Date: Wed, 26 Aug 2009 12:09
Date: Wed, 26 Aug 2009 12:09
16 lines
1488 bytes
1488 bytes
Dnia 26.08.2009 Barti <barti@example.com> napisał/a:
>> Mam mały problem z mechanize. Nie bardzo rozumiem czemu po wybraniu
>> formy nie ma w niej imputów. Brakuje email i password. Przy próbie ich
>> ustawienia (b.form['email'] = 'email') dostaję błąd:
>> [...]
>>
>> Zetknął się z tym ktoś?
> Tak, wszystko już było: ;)
> http://groups.google.com/group/pl.comp.lang.python/browse_thread/thread/b414efccd5922cc0/e7b869b29f2c594c
Dzięki. Nie spodziewałem się że to wynika z błędnej składni (x)htmla.
Teraz już z górki. ;)
--
Adam "Prawda jest prosta - gdyby było inaczej
każdy głupiec mógłby ją zrozumieć".
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads