I'm a longtime viewer and first-time asker here at stackoverflow, so excuse me for my newbieness.
I've been struggling with something for the past 2 hours now, looked up several questions like this but none really helped me with this problem.
What i've got so far:
*
import http.cookiejar
import urllib
url = 'https://www.facebook.com/login.php'
values = {'email' : 'example@gmail.com',
'pass' : 'mypassword' }
data = urllib.parse.urlencode(values)
cookies = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(
urllib.request.HTTPRedirectHandler(),
urllib.request.HTTPHandler(debuglevel=0),
urllib.request.HTTPSHandler(debuglevel=0),
urllib.request.HTTPCookieProcessor(cookies))
binary_data = data.encode('ascii')
response = opener.open(url, binary_data)
the_page = response.read()
http_headers = response.info()
*
There are no errors, but what i'm trying to achieve is that it could somehow tell me if the login was successful or not.
I tried if "Logout" in str(response.read()):
which, sadly, didn't do anything.
I also tried the try / except -method, which again, did nothing.
Any help would be greatly appreciated!