|  | @@ -116,7 +116,6 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |          self.login()
 |  |          self.login()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def login(self):
 |  |      def login(self):
 | 
											
												
													
														|  | -        self.remove_cookie(self.username)
 |  | 
 | 
											
												
													
														|  |          """Login user if needed"""
 |  |          """Login user if needed"""
 | 
											
												
													
														|  |          LOGGER.info('"%s": start login, method: "%s"',
 |  |          LOGGER.info('"%s": start login, method: "%s"',
 | 
											
												
													
														|  |                      self.username, self.login_method)
 |  |                      self.username, self.login_method)
 | 
											
										
											
												
													
														|  | @@ -195,7 +194,7 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |              LOGGER.debug('"%s": closing login tab', self.username)
 |  |              LOGGER.debug('"%s": closing login tab', self.username)
 | 
											
												
													
														|  |              browser.close_current_tab()
 |  |              browser.close_current_tab()
 | 
											
												
													
														|  |          else:
 |  |          else:
 | 
											
												
													
														|  | -            LOGGER.info('Cookies found')
 |  | 
 | 
											
												
													
														|  | 
 |  | +            LOGGER.info('"%s": Cookies found', self.username)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          self.session = cfscrape.CloudflareScraper()
 |  |          self.session = cfscrape.CloudflareScraper()
 | 
											
												
													
														|  |          for cookie in cookies:
 |  |          for cookie in cookies:
 | 
											
										
											
												
													
														|  | @@ -298,7 +297,7 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          with open('{}/cookies.json'.format(DATA_DIR), 'w+') as cookies_file:
 |  |          with open('{}/cookies.json'.format(DATA_DIR), 'w+') as cookies_file:
 | 
											
												
													
														|  |              json.dump(cookies, cookies_file)
 |  |              json.dump(cookies, cookies_file)
 | 
											
												
													
														|  | -        LOGGER.info('"%s": Saved cookie for', username)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        LOGGER.info('"%s": Saved cookie', username)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @classmethod
 |  |      @classmethod
 | 
											
												
													
														|  |      def get_cookies(cls, username):
 |  |      def get_cookies(cls, username):
 | 
											
										
											
												
													
														|  | @@ -331,7 +330,7 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |      @classmethod
 |  |      @classmethod
 | 
											
												
													
														|  |      def remove_cookie(cls, username):
 |  |      def remove_cookie(cls, username):
 | 
											
												
													
														|  |          """Remove cookie from storage"""
 |  |          """Remove cookie from storage"""
 | 
											
												
													
														|  | -        LOGGER.info('"%s": Removing cookie for', username)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        LOGGER.info('"%s": Removing cookie', username)
 | 
											
												
													
														|  |          cookies = None
 |  |          cookies = None
 | 
											
												
													
														|  |          try:
 |  |          try:
 | 
											
												
													
														|  |              with open('{}/cookies.json'.format(DATA_DIR), 'r') as cookies_file:
 |  |              with open('{}/cookies.json'.format(DATA_DIR), 'r') as cookies_file:
 | 
											
										
											
												
													
														|  | @@ -464,17 +463,19 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |      def send_conference_message(self, conference_id, message):
 |  |      def send_conference_message(self, conference_id, message):
 | 
											
												
													
														|  |          """send conference message"""
 |  |          """send conference message"""
 | 
											
												
													
														|  |          LOGGER.info(
 |  |          LOGGER.info(
 | 
											
												
													
														|  | -                '"%s" CONF: id %s',
 |  | 
 | 
											
												
													
														|  | 
 |  | +                '"%s": CONF "%s": send message',
 | 
											
												
													
														|  |                  self.username, conference_id
 |  |                  self.username, conference_id
 | 
											
												
													
														|  |              )
 |  |              )
 | 
											
												
													
														|  |          if self.session:
 |  |          if self.session:
 | 
											
												
													
														|  |              response = self.session.get("https://rivalregions.com/#overview")
 |  |              response = self.session.get("https://rivalregions.com/#overview")
 | 
											
												
													
														|  |              if "Session expired, please, reload the page" in response.text:
 |  |              if "Session expired, please, reload the page" in response.text:
 | 
											
												
													
														|  |                  raise SessionExpireException()
 |  |                  raise SessionExpireException()
 | 
											
												
													
														|  | -            browser = Browser(showWindow=self.show_window)
 |  | 
 | 
											
												
													
														|  | 
 |  | +            browser = Browser(showWindow=True)
 | 
											
												
													
														|  |              browser.go_to('https://rivalregions.com/')
 |  |              browser.go_to('https://rivalregions.com/')
 | 
											
												
													
														|  | -            for cookie in self.get_cookies(self.username):
 |  | 
 | 
											
												
													
														|  | -                browser.add_cookie(cookie)
 |  | 
 | 
											
												
													
														|  | 
 |  | +            for cookie_name, value in self.session.cookies.get_dict().items():
 | 
											
												
													
														|  | 
 |  | +                browser.add_cookie(
 | 
											
												
													
														|  | 
 |  | +                    self.create_cookie(cookie_name, None, value)
 | 
											
												
													
														|  | 
 |  | +                )
 | 
											
												
													
														|  |              browser.go_to(
 |  |              browser.go_to(
 | 
											
												
													
														|  |                      'https://rivalregions.com/#slide/conference/{}'
 |  |                      'https://rivalregions.com/#slide/conference/{}'
 | 
											
												
													
														|  |                      .format(conference_id)
 |  |                      .format(conference_id)
 | 
											
										
											
												
													
														|  | @@ -495,7 +496,7 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |                                  ' '.join(tmp_sentence)
 |  |                                  ' '.join(tmp_sentence)
 | 
											
												
													
														|  |                              )
 |  |                              )
 | 
											
												
													
														|  |                          LOGGER.info(
 |  |                          LOGGER.info(
 | 
											
												
													
														|  | -                                '"%s" CONF: id %s, next message length: %s',
 |  | 
 | 
											
												
													
														|  | 
 |  | +                                '"%s": CONF "%s": next message length: %s',
 | 
											
												
													
														|  |                                  self.username, conference_id, len(message)
 |  |                                  self.username, conference_id, len(message)
 | 
											
												
													
														|  |                              )
 |  |                              )
 | 
											
												
													
														|  |                          browser.type(message, id='message')
 |  |                          browser.type(message, id='message')
 | 
											
										
											
												
													
														|  | @@ -523,15 +524,15 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |              if tmp_messages:
 |  |              if tmp_messages:
 | 
											
												
													
														|  |                  message = '\n'.join(tmp_messages)
 |  |                  message = '\n'.join(tmp_messages)
 | 
											
												
													
														|  |                  LOGGER.info(
 |  |                  LOGGER.info(
 | 
											
												
													
														|  | -                        'conference %s: next message length: %s',
 |  | 
 | 
											
												
													
														|  | -                        conference_id, len(message)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        '"%s": CONF "%s": next message length: %s',
 | 
											
												
													
														|  | 
 |  | +                        self.username, conference_id, len(message)
 | 
											
												
													
														|  |                      )
 |  |                      )
 | 
											
												
													
														|  |                  browser.type(message, id='message')
 |  |                  browser.type(message, id='message')
 | 
											
												
													
														|  |                  browser.click(id='chat_send')
 |  |                  browser.click(id='chat_send')
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              LOGGER.info(
 |  |              LOGGER.info(
 | 
											
												
													
														|  | -                    'conference %s: finished sending message',
 |  | 
 | 
											
												
													
														|  | -                    conference_id
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    '"%s": CONF "%s": finished sending message',
 | 
											
												
													
														|  | 
 |  | +                    self.username, conference_id
 | 
											
												
													
														|  |                  )
 |  |                  )
 | 
											
												
													
														|  |              browser.close_current_tab()
 |  |              browser.close_current_tab()
 | 
											
												
													
														|  |          else:
 |  |          else:
 | 
											
										
											
												
													
														|  | @@ -541,7 +542,7 @@ class AuthenticationHandler:
 | 
											
												
													
														|  |      def send_conference_notification(self, conference_id, message, sound):
 |  |      def send_conference_notification(self, conference_id, message, sound):
 | 
											
												
													
														|  |          """send conference notification"""
 |  |          """send conference notification"""
 | 
											
												
													
														|  |          LOGGER.info(
 |  |          LOGGER.info(
 | 
											
												
													
														|  | -                '"%s" CONF: id %s notification ',
 |  | 
 | 
											
												
													
														|  | 
 |  | +                '"%s": CONF: %s notification',
 | 
											
												
													
														|  |                  self.username, conference_id
 |  |                  self.username, conference_id
 | 
											
												
													
														|  |              )
 |  |              )
 | 
											
												
													
														|  |          data = {
 |  |          data = {
 |