web scraping - logging into website using python -


i trying login website using python.i connected vpn. below code.

import requests  requests.session() c:     url = 'https://servicedesknew.ascorp.com/caisd/pdmweb.exe'     username = 'salmansa'     password = '********'     c.get(url)     csrftoken = c.cookies['crfstoken']     login_data = dict(csrfmiddlewaretoken=csrftoken, username=username,pin=password ,next='/')     c.post(url,data=login_data, headers={"referer" : "https://servicedesknew.ascorp.com/caisd/pdmweb.exe"})     page = c.get('https://servicedesknew.ascorp.com/caisd/pdmweb.exe')     print(page.content) 

when run code error below.

c:\python34\python.exe c:/users/salmansa/pycharmprojects/untitled1/test2.py usage: test2.py [-h] username password test2.py: error: following arguments required: username, password  process finished exit code 2 

please let me know if missing anything.


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -