I read several similar topic.. I try to follow the others examples but I'm still stuck in the middle of nowhere.. I have basic skills of python programming and little knowledge about http protocol, my two goals are: -succesfull authentication to a website via requests library -fetch data from the website after the login while the session is active
This is the code:
import requests
targetws = 'https://secure.advfn.com/login/secure'
s = requests.session()
payload_data = {'login_username': 'xxx', 'login_password': 'yyy'}
response = s.post(targetws, data=payload_data)
url='https://it.advfn.com/mercati/BIT/generali-G/ordini'
result = s.get(url)
print result.content
But I always get no success with log in.. Maybe I miss some value in post data like submit action or else? Any help will be appreciated, best regards!
Here the html code from the page:
form action="https://secure.advfn.com/login/secure" id="login_form" name="login_form" method="POST" target="">
<input type="hidden" value="aHR0cDovL2l0LmFkdmZuLmNvbQ==" name="redirect_url" id="redirect_url">
<input type="hidden" value="it" name="site" id="site">
<div class="fields"><label for="login_username">Username</label>
<input type="text" tabindex="1" class="text ui-widget-content" value =""
id="login_username" name="login_username" maxlength="64">
</div>
<div class="fields"><label for="login_password">Password</label>
<input tabindex="2" type="password" class="text ui-widget-content" value="" id="login_password" name="login_password" maxlength="16">
</div>
<div class="fields">
<strong><a href="/common/account/password/request">Se ti sei dimenticato la tua password</a></strong>
<input class="button" tabindex="3" type="submit" value="Accedi" id="login_submit">
</div>
</form

status_codeandtextattributes.