Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Stone
BucknellScheduler
Commits
83ca7a6e
Commit
83ca7a6e
authored
Nov 18, 2021
by
Thomas Stone
Browse files
we got the pickle back!
parent
fb0db627
Changes
7
Hide whitespace changes
Inline
Side-by-side
app.yaml
View file @
83ca7a6e
runtime
:
python39
api_version
:
1
threadsafe
:
true
handlers:-
url
:
/static
static_dir
:
static-
url
:
/.*
script
:
webserver.py
libraries
:
-
name
:
ssl
version
:
latest
\ No newline at end of file
runtime
:
python39
handlers
:
-
url
:
/static
static_dir
:
static
-
url
:
/.*
script
:
auto
\ No newline at end of file
backend/calendar/cal_setup.py
View file @
83ca7a6e
import
datetime
import
pickle
import
os.path
from
webbrowser
import
get
from
googleapiclient.discovery
import
build
from
google_auth_oauthlib.flow
import
InstalledAppFlow
from
google.auth.transport.requests
import
Request
...
...
@@ -32,4 +33,7 @@ def get_calendar_service():
pickle
.
dump
(
creds
,
token
)
service
=
build
(
'calendar'
,
'v3'
,
credentials
=
creds
)
return
service
\ No newline at end of file
return
service
if
__name__
==
'__main__'
:
get_calendar_service
()
\ No newline at end of file
backend/calendar/token.pickle
deleted
100644 → 0
View file @
fb0db627
File deleted
credentials/credentials.json
View file @
83ca7a6e
{
"web"
:{
"client_id"
:
"259120833380-733br30ukc4vuotg505hlc792e4i94tk.apps.googleusercontent.com"
,
"project_id"
:
"bucknellschedule"
,
"auth_uri"
:
"https://accounts.google.com/o/oauth2/auth"
,
"token_uri"
:
"https://oauth2.googleapis.com/token"
,
"auth_provider_x509_cert_url"
:
"https://www.googleapis.com/oauth2/v1/certs"
,
"client_secret"
:
"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"
,
"redirect_uris"
:[
"https://localhost"
]}}
\ No newline at end of file
{
"web"
:{
"client_id"
:
"259120833380-a71hd47n7sphnkvisqng0bfrftiootoq.apps.googleusercontent.com"
,
"project_id"
:
"bucknellschedule"
,
"auth_uri"
:
"https://accounts.google.com/o/oauth2/auth"
,
"token_uri"
:
"https://oauth2.googleapis.com/token"
,
"auth_provider_x509_cert_url"
:
"https://www.googleapis.com/oauth2/v1/certs"
,
"client_secret"
:
"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"
,
"redirect_uris"
:[
"http://localhost:53309/"
]}}
\ No newline at end of file
credentials/generate_token.py
0 → 100644
View file @
83ca7a6e
import
datetime
import
pickle
import
os.path
from
googleapiclient.discovery
import
build
from
google_auth_oauthlib.flow
import
InstalledAppFlow
from
google.auth.transport.requests
import
Request
# If modifying these scopes, delete the file token.pickle.
SCOPES
=
[
'https://www.googleapis.com/auth/calendar'
]
CREDENTIALS_FILE
=
'credentials.json'
def
get_calendar_service
():
creds
=
None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if
os
.
path
.
exists
(
'token.pickle'
):
with
open
(
'token.pickle'
,
'rb'
)
as
token
:
creds
=
pickle
.
load
(
token
)
# If there are no (valid) credentials available, let the user log in.
if
not
creds
or
not
creds
.
valid
:
if
creds
and
creds
.
expired
and
creds
.
refresh_token
:
creds
.
refresh
(
Request
())
else
:
flow
=
InstalledAppFlow
.
from_client_secrets_file
(
CREDENTIALS_FILE
,
SCOPES
)
creds
=
flow
.
run_local_server
(
port
=
0
)
# Save the credentials for the next run
with
open
(
'token.pickle'
,
'wb'
)
as
token
:
pickle
.
dump
(
creds
,
token
)
service
=
build
(
'calendar'
,
'v3'
,
credentials
=
creds
)
return
service
if
__name__
==
'__main__'
:
service
=
get_calendar_service
()
# Call the Calendar API
print
(
'Getting list of calendars'
)
calendars_result
=
service
.
calendarList
().
list
().
execute
()
calendars
=
calendars_result
.
get
(
'items'
,
[])
if
not
calendars
:
print
(
'No calendars found.'
)
for
calendar
in
calendars
:
summary
=
calendar
[
'summary'
]
id
=
calendar
[
'id'
]
primary
=
"Primary"
if
calendar
.
get
(
'primary'
)
else
""
print
(
"%s
\t
%s
\t
%s"
%
(
summary
,
id
,
primary
))
\ No newline at end of file
credentials/token.pickle
View file @
83ca7a6e
No preview for this file type
static/css/buttons.css
View file @
83ca7a6e
.
generate_schedule_btn
{
#
generate_schedule_btn
{
margin
:
1em
;
appearance
:
none
;
background-color
:
#2e8ca4
;
...
...
@@ -6,7 +6,7 @@
border-radius
:
6px
;
box-shadow
:
rgba
(
27
,
31
,
35
,
.1
)
0
1px
0
;
box-sizing
:
border-box
;
color
:
#2e8ca4
;
color
:
white
;
cursor
:
pointer
;
display
:
inline-block
;
padding
:
14px
16px
;
...
...
@@ -17,28 +17,28 @@
white-space
:
nowrap
;
}
.
generate_schedule_btn
:focus:not
(
:focus-visible
)
:not
(
.focus-visible
)
{
#
generate_schedule_btn
:focus:not
(
:focus-visible
)
:not
(
.focus-visible
)
{
box-shadow
:
none
;
outline
:
none
;
}
.
generate_schedule_btn
:hover
{
#
generate_schedule_btn
:hover
{
background-color
:
#2e7fa4
;
}
.
generate_schedule_btn
:focus
{
#
generate_schedule_btn
:focus
{
box-shadow
:
rgba
(
46
,
164
,
79
,
.4
)
0
0
0
3px
;
outline
:
none
;
}
.
generate_schedule_btn
:disabled
{
#
generate_schedule_btn
:disabled
{
background-color
:
#94d3a2
;
border-color
:
rgba
(
27
,
31
,
35
,
.1
);
color
:
rgba
(
255
,
255
,
255
,
.8
);
cursor
:
default
;
}
.
generate_schedule_btn
:active
{
#
generate_schedule_btn
:active
{
background-color
:
#2e75a4
;
box-shadow
:
rgba
(
20
,
70
,
32
,
.2
)
0
1px
0
inset
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment