How to authorize on site without login-form page?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

How to authorize on site without login-form page?



How to authorize on site without login-form page. This site uses modal form with url like this http://example-site.com/#myModal.



I tried:


s = requests.Session()
data = "login_name":"admin", "login_password":"password"
url = "http://example-site.com/#myModal"
r = s.post(url, data=data, headers='User-Agent': 'Mozilla/5.0')
html = s.get('http://example-site/forauthorizedusers.html',headers='User-Agent': 'Mozilla/5.0' )
print(html.text)



In result of this code I got html page for non-authorized users.



HTML code of site is:


form class="form-inline" method="post" action="">
<input type="text" name="login_name" id="login_name" class="input-small" style="margin-top: -2px;" placeholder="Login">
<input type="password" name="login_password" id="login_password" style="margin-top: -2px;" class="input-small" placeholder="Password">
<button style="margin-bottom: 0px;margin-top: -2px;margin-left: 0px;" type="submit" nclick="submit();" class="btn btn-info " >Log in</button>
<input name="login" type="hidden" id="login" value="submit" />
</form>




1 Answer
1



Try this:


r = s.post(url, auth=HTTPBasicAuth('admin', 'password'), headers='User-Agent': 'Mozilla/5.0')



http://docs.python-requests.org/en/master/user/authentication/






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

Trying to Print Gridster Items to PDF without overlapping contents

Mass disable jenkins jobs