Google-GonG script is almost done! Added some todos.
This commit is contained in:
Binary file not shown.
21
Scripts/google_local_scripts/google.txt
Normal file
21
Scripts/google_local_scripts/google.txt
Normal file
@ -0,0 +1,21 @@
|
||||
cachetools==5.3.2
|
||||
certifi==2024.2.2
|
||||
charset-normalizer==3.3.2
|
||||
google-api-core==2.17.0
|
||||
google-api-python-client==2.118.0
|
||||
google-auth==2.27.0
|
||||
google-auth-httplib2==0.2.0
|
||||
google-auth-oauthlib==1.2.0
|
||||
googleapis-common-protos==1.62.0
|
||||
httplib2==0.22.0
|
||||
idna==3.6
|
||||
oauthlib==3.2.2
|
||||
protobuf==4.25.2
|
||||
pyasn1==0.5.1
|
||||
pyasn1-modules==0.3.0
|
||||
pyparsing==3.1.1
|
||||
requests==2.31.0
|
||||
requests-oauthlib==1.3.1
|
||||
rsa==4.9
|
||||
uritemplate==4.1.1
|
||||
urllib3==2.2.0
|
||||
@ -1,6 +1,8 @@
|
||||
import datetime
|
||||
import time
|
||||
import subprocess
|
||||
import os
|
||||
import reference
|
||||
|
||||
from google.auth.transport.requests import Request
|
||||
from google.oauth2.credentials import Credentials
|
||||
@ -10,6 +12,7 @@ from googleapiclient.errors import HttpError
|
||||
|
||||
# If modifying these scopes, delete the file token.json.
|
||||
SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"]
|
||||
IGNORE_TYPES = ["workingLocation", "outOfOffice", "focusTime"]
|
||||
|
||||
|
||||
def main():
|
||||
@ -55,29 +58,50 @@ def main():
|
||||
print("No upcoming events found.")
|
||||
return
|
||||
|
||||
# curr_client = "Artera"
|
||||
# if curr_client in reference.GONG_URLS.keys():
|
||||
# cmd=f'''osascript -e 'display notification "Meeting with {curr_client} soon. Opening GonG URL"' '''
|
||||
# os.system(cmd)
|
||||
# time.sleep(5)
|
||||
# os.system(f"open {reference.BASE_URL}{reference.GONG_URLS[curr_client]}")
|
||||
# else:
|
||||
# print("Not found")
|
||||
# Prints the start and name of the next 10 events
|
||||
for event in events:
|
||||
# Parse the datetime first
|
||||
start = event["start"].get("dateTime", event["start"].get("date"))[:-6]
|
||||
# start = start[:-6]
|
||||
start_time = datetime.datetime.strptime(start, "%Y-%m-%dT%H:%M:%S")
|
||||
now = datetime.datetime.now()
|
||||
if len(start) > 4:
|
||||
if event["eventType"] not in IGNORE_TYPES:
|
||||
# start = start[:-6]
|
||||
start_time = datetime.datetime.strptime(start, "%Y-%m-%dT%H:%M:%S")
|
||||
now = datetime.datetime.now()
|
||||
difference = start_time - now
|
||||
seconds_in_day = 24 * 60 * 60
|
||||
time_left_in_min_sec = divmod(difference.days * seconds_in_day + difference.seconds, 60)
|
||||
# print(time_left_in_min_sec)
|
||||
|
||||
difference = start_time - now
|
||||
seconds_in_day = 24 * 60 * 60
|
||||
time_left_in_min_sec = divmod(difference.days * seconds_in_day + difference.seconds, 60)
|
||||
|
||||
# Then parse the name to attribute it to a client.
|
||||
client_name = event["summary"]
|
||||
# if time_left_in_min_sec[0] < 1:
|
||||
# print("Upcoming Meeting")
|
||||
# else:
|
||||
# print("Nothing new")
|
||||
# print(start, event["organizer"]["email"])
|
||||
if event["eventType"] != "outOfOffice":
|
||||
# print(event["organizer"]["email"])
|
||||
for items in event["attendees"]:
|
||||
print(items["email"])
|
||||
# Then parse the name to attribute it to a client.
|
||||
client_name = event["summary"]
|
||||
print(client_name)
|
||||
if time_left_in_min_sec[0] < 10 and time_left_in_min_sec > 0:
|
||||
if client_name in reference.GONG_URLS.keys():
|
||||
cmd=f'''osascript -e 'display notification "Meeting with {curr_client} soon. Opening GonG URL"' '''
|
||||
os.system(cmd)
|
||||
time.sleep(5)
|
||||
os.system(f"open {reference.BASE_URL}{reference.GONG_URLS[curr_client]}")
|
||||
else:
|
||||
# print("Not found")
|
||||
pass
|
||||
# print("Upcoming Meeting")
|
||||
# if client_name in reference.GONG_URLS.keys()
|
||||
else:
|
||||
pass
|
||||
# print("Nothing new")
|
||||
# print(start, event["organizer"]["email"])
|
||||
# if event["eventType"] != "outOfOffice":
|
||||
# print(event["organizer"]["email"])
|
||||
# for items in event["attendees"]:
|
||||
# print(items["email"])
|
||||
|
||||
except HttpError as error:
|
||||
print(f"An error occurred: {error}")
|
||||
|
||||
@ -2,4 +2,5 @@ BASE_URL = "https://gongnxt.gainsightcloud.com/v1/ui/Relationship360?rid="
|
||||
GONG_URLS = {
|
||||
"Walmart": "1P05THJ9MQ1NI1RKR6QQ442410ZA26YL3OOG",
|
||||
"Artera": "1P05THJ9MQ1NI1RKR6WHF2NXWEH8AAXPL2BE",
|
||||
"Williams-Sonoma": "1P05THJ9MQ1NI1RKR69M3N24VZFAGCIQ7UFV",
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
{"token": "ya29.a0AfB_byBRSc2nNXg8jIMk7kStUgZjXCL7dSBr3MiYOxiI8Hxrs5WtqC0ty-YYBYXASu4rbN6DQU5AjRnm3hPLFhsAN9QoDRGexoTK14cEmDsgZUk5RCbKeFhmuWt0-7FE8cxDmsdKWMZM2Yep9RVssVdHg3u9LeXl56isaCgYKAckSARESFQHGX2MiZsmJWVHqQzmC999ESm_9Eg0171", "refresh_token": "1//05KRHdKJcPDY7CgYIARAAGAUSNwF-L9Irk_qUBGUHLodmFLbL0nzj6164LXHuHXODdui_wfz9itU_nuIOrUXGlleOjbhcOpxOjj4", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "630068342412-r85f2brntqqv1jd3kt5ue1a461677hnp.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://www.googleapis.com/auth/calendar.readonly"], "universe_domain": "googleapis.com", "account": "", "expiry": "2024-02-13T21:39:33.375822Z"}
|
||||
{"token": "ya29.a0Ad52N39Rs0sib-3L0BC-BDVEM1ePjKW_ndcSn5crBfMEhnAAj0awhvqSemNO2DuEw9GEQBgYiNvDFx63IPM_pQMT64Ge0sZSYAp4bjL8xRUhfGX7HEXzEUH0bfLklpMBIWoKT3qrzNM9ySymCIe-rIBss9eDMtDbuCNl-BoaCgYKAVgSARESFQHGX2Mi0lNIa41SivQf_wy1wSc7zg0174", "refresh_token": "1//05KRHdKJcPDY7CgYIARAAGAUSNwF-L9Irk_qUBGUHLodmFLbL0nzj6164LXHuHXODdui_wfz9itU_nuIOrUXGlleOjbhcOpxOjj4", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "630068342412-r85f2brntqqv1jd3kt5ue1a461677hnp.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://www.googleapis.com/auth/calendar.readonly"], "universe_domain": "googleapis.com", "account": "", "expiry": "2024-04-16T21:44:11.236792Z"}
|
||||
4
Todos.md
4
Todos.md
@ -196,7 +196,7 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th
|
||||
- [ ] DoorDash
|
||||
- [ ] DoubleVerify
|
||||
- [ ] DouglasElliman
|
||||
- [ ] Flink
|
||||
- [X] Flink
|
||||
- [ ] Humly
|
||||
- [ ] Glassdoor
|
||||
- [ ] HackerRank
|
||||
@ -207,8 +207,8 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th
|
||||
- [ ] StopItSolutions
|
||||
- [ ] Swift Medical
|
||||
- [ ] TripleSeat
|
||||
- [X] Artera (WellHealth)
|
||||
- [ ] Terminus
|
||||
- [ ] Artera (WellHealth)
|
||||
|
||||
|
||||
- [ ] G2 - Get group booking link for me and Nergis
|
||||
|
||||
Reference in New Issue
Block a user