FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-webuntis/examples/html_timetable.py at master · robquant/python-webuntis · GitHub
robquant
/
python-webuntis
Public
forked from
python-webuntis/python-webuntis
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-webuntis
/
examples
/
html_timetable.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (27 loc) · 1.03 KB
Breadcrumbs
python-webuntis
/
examples
/
html_timetable.py
Copy path
File metadata and controls
37 lines (27 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
35
36
37
from
credentials
import
s
import
datetime
import
logging
# ***DO NOT USE THIS EXAMPLE AS-IS***
# Properties that are printed here may contain arbitrary
# *unescaped* HTML. That is not expected, but you should not trust
# input from remote sources in general.
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
today
=
datetime
.
date
.
today
()
monday
=
today
-
datetime
.
timedelta
(
days
=
today
.
weekday
())
friday
=
monday
+
datetime
.
timedelta
(
days
=
4
)
klasse
=
s
.
klassen
().
filter
(
name
=
'1A'
)[
0
]
table
=
s
.
timetable
(
klasse
=
klasse
,
start
=
monday
,
end
=
friday
).
to_table
()
print
(
'<table border="1"><thead><th>Time</th>'
)
for
weekday
in
[
'Monday'
,
'Tuesday'
,
'Wednesday'
,
'Thursday'
,
'Friday'
]:
print
(
'<th>'
+
str
(
weekday
)
+
'</th>'
)
print
(
'</thead><tbody>'
)
for
time
,
row
in
table
:
print
(
'<tr>'
)
print
(
'<td>{}</td>'
.
format
(
time
.
strftime
(
'%H:%M'
)))
for
date
,
cell
in
row
:
print
(
'<td>'
)
for
period
in
cell
:
print
(
', '
.
join
(
su
.
name
for
su
in
period
.
subjects
))
print
(
'</td>'
)
print
(
'</tr>'
)
print
(
'</tbody></table>'
)
Back
|
FazBrowse Home
|
New Git URL