How can I get cookies of a website from browser using python? The code currently being used is:
get_title = lambda html: re.findall('<title>(.*?)</title>', html, flags=re.DOTALL)[0].strip()
url = config.base_url
public_html = urllib2.urlopen(url).read()
print get_title(public_html)
cj = browsercookie.firefox()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_html = opener.open(url).read()
print get_title(login_html)
This code comes after the application has logged in. config.base_url = "https://10.194.13.71" It is giving this error : c** File "/root/Desktop/mysonicwallnew/testservice.py", line 26, in test_service public_html = urllib2.urlopen(url).read()
CertificateError: hostname '10.194.31.71' doesn't match either of 'www.abc.com', 'abc.com' ** How do I fix this?