Python Forum
Login a Python Web Crawler on a ASP NET (.aspx) website
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Login a Python Web Crawler on a ASP NET (.aspx) website
#1


I'm developing a Web Crawler in Python 3.4 to Scrap some info from a Call Reporter platform developed in ASP.NET. I already did all the code to scrap the content I want and the only thing is left to finish my script is the login.
What i need to login a system built on ASP.NET by a Python Web Crawler?

The code below is the login part of my script:

import requests
from lxml import html

USERNAME = "<USERNAME>"
PASSWORD = "<PASSWORD>"

LOGIN_URL = "<LOGIN_URL"
URL = "<URL>"

def main():
    session_requests = requests.session()

    # Get login hash - VIEWSTATE
    result = session_requests.get(LOGIN_URL)
    tree = html.fromstring(result.text)
    HASH = list(set(tree.xpath("//input[@name='__VIEWSTATE']/@value")))[0]

    # Create payload
    payload = {
        "LoginViewControl$userLogonControl$UserName": USERNAME,
        "LoginViewControl$userLogonControl$Password": PASSWORD,
        "LoginViewControl$userLogonControl$DropDownLanguage": "English-US",
        "LoginViewControl$userLogonControl$PasswordHash": HASH
    }

    # Perform login
    session_requests.get(LOGIN_URL, data=payload, headers=dict(referer=LOGIN_URL))
	
	"""
	The script continues
	"""
Reply
#2
This is still not a very helpful post.
Its very difficult to validate or to advice anything without seeing the HTML.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  in a login interface when i try login with a user supposed to say test123 but nothing NullAdmin 3 2,264 Feb-20-2021, 04:43 AM
Last Post: bowlofred
  Login to NordVPN on Linux with python script AGreenPig 2 5,967 Feb-09-2021, 10:44 AM
Last Post: AGreenPig
  Login to Corporate Website tkj80 2 2,808 Aug-15-2018, 02:19 AM
Last Post: tkj80
  Python login system help. calumw20 1 3,689 Mar-06-2018, 08:01 AM
Last Post: buran
  Creating a Login System Using Python- HELP tesilstudent112 0 9,554 Dec-08-2017, 07:17 PM
Last Post: tesilstudent112
  Is the Python website good for learning Python? OnisionTheOninonBoy 18 11,307 Jan-30-2017, 09:21 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020