Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified code for google calendar integration #848

Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion zulip/integrations/google/get-google-credentials
Original file line number Diff line number Diff line change
@@ -7,7 +7,11 @@ from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow

flags = argparse.ArgumentParser(description="Google Calendar Bot")
flags.add_argument("--noauth_local_webserver", action="store_true", help="Run OAuth flow in console instead of opening a web browser.")
flags.add_argument(
"--noauth_local_webserver",
action="store_true",
help="Run OAuth flow in console instead of opening a web browser.",
)
args = flags.parse_args()

# If modifying these scopes, delete your previously saved credentials
@@ -22,6 +26,7 @@ APPLICATION_NAME = "Zulip Calendar Bot"
HOME_DIR = os.path.expanduser("~")
CREDENTIALS_PATH = os.path.join(HOME_DIR, "google-credentials.json")


def get_credentials() -> Credentials:
"""Gets valid user credentials from storage.

2 changes: 2 additions & 0 deletions zulip/integrations/google/google-calendar
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ if not options.zulip_email:

zulip_client = zulip.init_from_options(options)


def get_credentials() -> Credentials:
"""Gets valid user credentials from storage.

@@ -111,6 +112,7 @@ def get_credentials() -> Credentials:

return creds


def populate_events() -> Optional[None]:
credentials = get_credentials()
service = build("calendar", "v3", credentials=credentials)