Ver código fonte

Update cookie expiry variable, wrap it inside try catch

Cammy 7 anos atrás
pai
commit
8ea5098f67
1 arquivos alterados com 7 adições e 3 exclusões
  1. 7 3
      pyinstalive/auth.py

+ 7 - 3
pyinstalive/auth.py

@@ -97,9 +97,13 @@ def login(username, password, show_cookie_expiry, ignore_existing_cookie):
 		seperator("GREEN")
 		sys.exit(99)
 
-	log('[I] Using cached login cookie for "' + api.authenticated_user_name + '".', "GREEN")
+	log('[I] Using login cookie for "' + api.authenticated_user_name + '".', "GREEN")
 	if show_cookie_expiry.title() == 'True' and not ignore_existing_cookie:
-		cookie_expiry = api.cookie_jar.expires_earliest
-		log('[I] Login cookie expiry date: {0!s}'.format(datetime.datetime.fromtimestamp(cookie_expiry).strftime('%Y-%m-%d at %I:%M:%S %p')), "GREEN")
+		try:
+			cookie_expiry = api.cookie_jar.auth_expires
+			log('[I] Login cookie expiry date: {0!s}'.format(datetime.datetime.fromtimestamp(cookie_expiry).strftime('%Y-%m-%d at %I:%M:%S %p')), "GREEN")
+		except AttributeError as e:
+			log('[W] An error occurred while getting the cookie expiry date: {0!s}'.format(e), "YELLOW")
+
 
 	return api