j-j-b-j / get-sentral Goto Github PK
View Code? Open in Web Editor NEWA simple Python function to summon your timetable from Sentral.
Home Page: https://j-j-b-j.github.io/get-sentral
License: Other
A simple Python function to summon your timetable from Sentral.
Home Page: https://j-j-b-j.github.io/get-sentral
License: Other
Is your feature request related to a problem? Please describe.
No. I would like the program to return Python objects instead of a json object, so as to use heavy type hinting.
Describe the solution you'd like
I would like the program to generate Python objects as opposed to json objects.
Describe alternatives you've considered
There are no alternatives that allow heavy type hinting.
Additional context
I would like the classes to all have the str and dict methods built in where possible.
Describe the bug
The current licence (GNU General Public License v3.0) allows for commercial use, among other things that I don't really think are very good for an open-source project
Expected behavior
I think that:
Additional context
The Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) licence has all of these features. The text here can be copied into the Licence
file, and the following code can be copied into README.md
:
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
The code outputs s logo and link like this:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
@SuperHarmony910 what do you think?
The program seems to have errors when importing the external modules.
To Reproduce
Expected behaviour
The program should import the modules with no errors.
Desktop (please complete the following information):
Additional context
Make sure that the imports work when using the program as a standalone as well as as a library.
Is your feature request related to a problem? Please describe.
Fetch the timetable from portal/timetable/mytimetable/x/daily
. This way, we can fetch multiple days at once.
Describe the solution you'd like
Completely revamp the timetable scraper code to scrape the timetable.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
In the HTML DOM structure, Sentral stores their periods horizontally; however, days are organised verticallym i.e. the first element in the DOM is Monday P1, the second element in the DOM is Tuesday P1. This makes me, as a programmer, very mildly infuriated.
Is your feature request related to a problem? Please describe.
Yeah kinda. You can still edit the journal in the app even when it isn't on Sentral.
Describe the solution you'd like
When the journal is not available, the program should return a custom error such as JournalNotAvailable
. Then, the app should have a try-except for this, as well as other example programs.
Describe alternatives you've considered
Setting the variable SentralTimetable.JOURNAL_UNAVAILABLE
, then the app can check if the journal matches this text. But then what happens if the user enters that exact text?
Additional context
I recommend this is left until the three current pull requests are merged.
Is your feature request related to a problem? Please describe.
No. I want some customisation options for the position of the tabs.
Describe the solution you'd like
Additional context
Noteflight has a good example of this. In the extremely rare case (๐) that you don't have an account, here is a screen recording:
Yes. I use a MacBook and Safari. Get over it.
Is your feature request related to a problem? Please describe.
Nope. I would like to be able to view and edit the journal thingy beneath the timetable in Sentral. I don't know anybody who uses it but it would be fun to build.
Describe the solution you'd like
There should be an addition to the objects where you can fetch your journal entry for today, and another, seperate function to set the contents.
Describe alternatives you've considered
None.
Additional context
N/A
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
Should reload on start, and periodically in the background, with the period decided in the settings tab. Should also reload on button press, and show last reloaded time in settings tab.
Describe alternatives you've considered
Reloading for a set amount of time for everyone, but this may not suit everyone.
Describe the bug
ON weekends and holidays, when there is no journal, The program may throw an error
To Reproduce
Steps to reproduce the behavior:
App.py
on the weekend and watch the outputExpected behavior
Text telling you the journal is not available should show up.
Desktop (please complete the following information):
Additional context
Add to the except in scrapers.py: line 161-5
. Add an IndexError
except.
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
I would like to be able to access awards data from Sentral. There should be a new object, Award()
with attributes like date
, teacher
and reason
.
Describe alternatives you've considered
N/A
Additional context
You can go to https://myschool.sentral.com.au/portal/wellbeing/awards/
, which takes you to this year's awards, then scrape the list. You can then continue clicking the Previous Year
button and scraping the list until the href of the Previous Year
button is #
.
The function names for the files and functions are a little ambiguous, as some of them are very similar to external libraries used. This may result in confusion and overlapping names in the future.
When the program is run, or it is used as a library, the phrase Created by SuperHarmony910 and J-J-B-J
is printed twice.
This appears to be due to a combination of two statements.
main.py
, line 7:
from SentralTimetable import scrapers, webdriver, credentials as creds
__init__.py
, line 2:
from .main import *
When main.py
uses from SentralTimetable
, it calls init.py
. init.py
then imports main.py
, which prints the statement.
Once main.py
has run it's imports, it prints out the statement again.
Proposed solution:
main.py
to timetable.py
so as to prevent confusion between example program (at the bottom of main.py) and the get_timetable()
function.Example.py
and cut the example code out of timetable.py
and paste it into here.The file that the program is meant to print the contents of, get_sentral.txt
, is not packages when the source is built. This means that when run from the packaged version, the program throws an error. A good way to fix this would be to place the contents of this file within the program as a multiline string.
To Reproduce
python3 -m build
or python3 setup.py sdist bdist_wheel
python3
shell, enter import SentralTimetable
Expected behaviour
The program outputs the following:
โญโโโฎ โญโโโฎ โญโโโฎ
โญโโโโโโโโโฎ โญโโโโโโโโโฎโญโโโ โฐโโโฎ โญโโโโโโโโฎ โญโโโโโโโโฎ โญโโโฎโญโโโโโโโโฎโญโโโ โฐโโโฎ โญโโฎโญโโโโโฎ โญโโโโโโโโโฎ โ โ
โ โญโโโฎ โ โ โญโโโฎ โโฐโโโฎ โญโโโฏ โ โญโโโโโฏ โ โญโโโฎ โ โ โฐโฏ โญโโโฎ โโฐโโโฎ โญโโโฏ โ โฐโฏโญโโฎ โ โฐโโโโโโฎ โ โ โ
โ โฐโโโฏ โ โ โฐโโโฏ โ โ โ โ โฐโโโโโฎ โ โฐโโโฏ โ โ โญโโฏ โ โ โ โ โ โญโฏ โฐโโฏ โญโโโโโโฏ โ โ โ
โฐโโโโโฎ โ โ โญโโโโโฏ โ โ โฐโโโโโฎ โ โ โญโโโโโฏ โ โ โ โ โ โ โ โ โ โญโโโโโฎ โ โ โ
โญโโโโโฏ โ โ โฐโโโโโฎ โ โฐโโโฎ โญโโโโโฏ โ โ โฐโโโโโฎ โ โ โ โ โ โฐโโโฎ โ โ โ โฐโโโโโฏ โ โ โ
โฐโโโโโโโโโฏ โฐโโโโโโโโโฏ โฐโโโโโโฏ โญโโโโโโโโโโโโโฎ โฐโโโโโโโโฏ โฐโโโโโโโโฏ โฐโโโโฏ โฐโโโฏ โฐโโโโโโฏ โฐโโโฏ โฐโโโโโโโโโฏ โฐโโโฏ
โฐโโโโโโโโโโโโโฏ
Desktop
Due to the datetime
not being imported in example.py
, the example program throws a NameError.
To Reproduce
example.py
Describe the bug
environment file generates the username as the variable USERNAME
whereas the program searches for USER_NAME
Expected behavior
program should look for the same variable as declared in env file otherwise it won't work
Desktop (please complete the following information):
The error handling for when the user enters an invalid timeout doesn't work.
To Reproduce
timeout
credential as an environment variable that isn't an integer or doesn't exist.Expected behaviour
The program continues and asks for input.
Line 30 is mis-indented.
The 404 page redirects to an invalid URL.
This should be fixed by taking the user to the root URL.
Upon closer inspection, this is due to Sentral, when there are no events, not creating the what is called in Srapers.py
events_div
.
Proposed fix:
Add an if statement to the error-causing line:
events_this_day = events_div.find_all('div')
Replace the above with:
if events_div:
events_this_day = events_div.find_all('div')
else:
# There are no events on this date
events_this_day = []
Is your feature request related to a problem? Please describe.
Yes. When there is an attachment for a daily notice, there is no way to view it.
Describe the solution you'd like
A new class should be created, called File. This class should have attributes such as the file type, URL and local URL (after downloading the file)
Describe alternatives you've considered
N/A
Additional context
N/A
Is your feature request related to a problem? Please describe.
Nope. I want to be able to view my reports using get-sentral.
Describe the solution you'd like
User
class, called .reports
. This should be of type list[File]
(see #24 & #15)File
objects in reports
should be files made from the reports.Describe alternatives you've considered
Downloading the report. You can't do this with selenium (see #15 and the selenium docs)
Additional context
The branch for working on this issue should be created from #24.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.