Issue
I'm using the following simple Python script to log in to a cgi page:
import requests
url = 'someSite'
data = {'username': '<userName>', 'password': '<password>'}
r = requests.post(url, data=data, verify=False)
But then I get the following error message:
Also, I have this message from Firefox at the bottom when I inspect the HTML:
This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1
So, what might be the problem?
Update: info: Python 2.7.9
Solution
The problem solved by using mechanize
instead of requests
. Here is the code I'm using:
import mechanize
loginURL = '<url>'
browser = mechanize.Browser()
browser.set_handle_robots(False)
browser.open(loginURL)
browser.select_form(nr = 0)
browser.form['username'] = '<username>'
browser.form['password'] = '<password>'
login = browser.submit()
Answered By - AhmedWas