1. import os
  2. import json
  3. def invalidate_cookies(cookie_file_path):
  4. """Invalidates cookies by deleting the cookie file."""
  5. try:
  6. os.remove(cookie_file_path)
  7. print(f"Cookie file '{cookie_file_path}' invalidated.") # Verbose log
  8. except FileNotFoundError:
  9. print(f"Cookie file '{cookie_file_path}' not found.") # Verbose log
  10. except Exception as e:
  11. print(f"Error invalidating cookie file '{cookie_file_path}': {e}") # Verbose log
  12. def main():
  13. """Main function to handle cookie invalidation."""
  14. cookie_file = os.path.join(os.path.expanduser("~"), ".cookie") # Default cookie file path
  15. # Check if the cookie file exists
  16. if os.path.exists(cookie_file):
  17. invalidate_cookies(cookie_file)
  18. else:
  19. print("No cookie file found.") #Verbose log
  20. if __name__ == "__main__":
  21. main()

Add your comment