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:
parent
46933a8156
commit
ee892b9d2c
|
@ -211,8 +211,10 @@ class HomeSFR (Common):
|
||||||
self.autologin = False
|
self.autologin = False
|
||||||
if cookies == None:
|
if cookies == None:
|
||||||
self.cookies = CookieJar ()
|
self.cookies = CookieJar ()
|
||||||
else:
|
elif type (cookies) == CookieJar:
|
||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
|
else:
|
||||||
|
raise TypeError ('Cookies must be CookieJar type.')
|
||||||
self.opener = request.build_opener (request.HTTPCookieProcessor (self.cookies))
|
self.opener = request.build_opener (request.HTTPCookieProcessor (self.cookies))
|
||||||
|
|
||||||
def __str__ (self):
|
def __str__ (self):
|
||||||
|
|
|
@ -207,8 +207,10 @@ class HomeSFR (Common):
|
||||||
self.autologin = False
|
self.autologin = False
|
||||||
if cookies == None:
|
if cookies == None:
|
||||||
self.cookies = CookieJar ()
|
self.cookies = CookieJar ()
|
||||||
else:
|
elif type (cookies) == CookieJar:
|
||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
|
else:
|
||||||
|
raise TypeError ('Cookies must be CookieJar type.')
|
||||||
self.opener = request.build_opener (request.HTTPCookieProcessor (self.cookies))
|
self.opener = request.build_opener (request.HTTPCookieProcessor (self.cookies))
|
||||||
|
|
||||||
def __str__ (self):
|
def __str__ (self):
|
||||||
|
|
Loading…
Reference in New Issue