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
11f59e21ef
commit
4359974efa
|
@ -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