#NEWLINE# def _set_cookies( base_url , cookies ) : #NEWLINE# #INDENT# cookie_file = os . path . join ( control . cookieDir , ( '%s_cookies.lwp' % shrink_host ( base_url ) ) ) #NEWLINE# cj = cookielib . LWPCookieJar ( cookie_file ) #NEWLINE# try : #NEWLINE# #INDENT# cj . load ( ignore_discard = True ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# control . log ( ( 'Before Cookies: %s - %s' % ( base_url , cookies_as_str ( cj ) ) ) ) #NEWLINE# domain = urlparse . urlsplit ( base_url ) . hostname #NEWLINE# for key in cookies : #NEWLINE# #INDENT# c = cookielib . Cookie ( 0 , base_url , str ( cookies [ key ] ) , port = None , port_specified = False , domain = domain , domain_specified = True , domain_initial_dot = False , path = '/' , path_specified = True , secure = False , expires = None , discard = False , comment = None , comment_url = None , rest = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# cj . set_cookie ( c ) #NEWLINE# #UNINDENT# cj . save ( ignore_discard = True ) #NEWLINE# return cj