Check the cookies type

Python2:
- Added type check for cookies param in HomeSFR class

Python3:
- Added type check for cookies param in HomeSFR class
This commit is contained in:
Gilles MOREL 2016-12-01 11:27:01 +01:00
parent 46933a8156
commit ee892b9d2c
2 changed files with 6 additions and 2 deletions

View File

@ -211,8 +211,10 @@ class HomeSFR (Common):
self.autologin = False
if cookies == None:
self.cookies = CookieJar ()
else:
elif type (cookies) == CookieJar:
self.cookies = cookies
else:
raise TypeError ('Cookies must be CookieJar type.')
self.opener = request.build_opener (request.HTTPCookieProcessor (self.cookies))
def __str__ (self):

View File

@ -207,8 +207,10 @@ class HomeSFR (Common):
self.autologin = False
if cookies == None:
self.cookies = CookieJar ()
else:
elif type (cookies) == CookieJar:
self.cookies = cookies
else:
raise TypeError ('Cookies must be CookieJar type.')
self.opener = request.build_opener (request.HTTPCookieProcessor (self.cookies))
def __str__ (self):