"""Re-authenticate Gmail OAuth - run this, then open the auth URL in browser.""" import asyncio import os import sys sys.path.insert(0, os.path.dirname(__file__)) from dotenv import load_dotenv load_dotenv(os.path.join(os.path.dirname(__file__), ".env")) load_dotenv(os.path.join(os.path.dirname(__file__), "../../.env")) from Gmail_Agent import GmailAgent async def main(): agent = GmailAgent() print("=" * 60) print("Gmail OAuth Re-Authentication") print("=" * 60) print("The OAuth callback server will start on localhost:8000.") print("When the auth URL appears below, open it in your browser.") print("After authorizing, the callback will be received here.") print("=" * 60) print() result = await agent.run( "Search for my latest 3 emails. My email is aiwithjawadsaghir@gmail.com" ) print() print("=" * 60) print("RESULT:", result) print("=" * 60) if __name__ == "__main__": asyncio.run(main())