File size: 977 Bytes
a66d4bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""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())