Reputation: 3
try:
res = self.browser.open('https://login.facebook.com/login.php?login_attempt=1',form_data)
response = res.read()
self.fbid = re.search('https://www.facebook.com/(.*)\?sk=info',response)
self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))
self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))
except urllib2.HTTPError,e :
print "****exception****inside login error code: %s" % (e.code)
res.close()
except urllib2.HTTPError,e :
print "****exception****inside login error code: %s" % (e.code)
#print " server Response Code: %s " % (res.code)
i got this
File "facebotv2.py", line 122, in login
self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))
AttributeError: 'NoneType' object has no attribute 'group'
Upvotes: 1
Views: 1080
Reputation: 11420
self.fbid
is None
after your first regular expression search. This probably means that you didn't find a match. If you want to prevent the error, you can conditionally only continue searching the result of the initial search with if self.fbid != None
Upvotes: 3