Giter Club home page Giter Club logo

app4flask's Introduction

app4flask

pipeline status

This is now hosted on gitlab here

THIS DOES NOT WORK ON ITS OWN

YOU MUST HAVE AN APP4 ACCOUNT

FOR THIS TO WORK

This is a simple flask server to scrape your timetable from app4 website then display it has a simple to parse webpage so that it can be displayed in things such has an web app or in things such has conky/rainmeter

To run first clone this then cd into the dir then run.

sudo pip install -r requirements.txt

Then set your schools name from the command line. You find the school name by looking at the app4 url https://{ This is your school name}.app4.ws

export school={{ school name }}

Then to run the server first cd into 'app4flask' then run.

python app.py

your timetable will be served at 127.0.0.1:5000/(user name)/(password)/list on first time run give it a minute or two so that it can scrape your timetable and add it to the database.

If you want to host it, you need to set up a uWSGI/nginx config or use gunicorn.

###Using the api ###---

once you have successfully installed the flask app and are hosting it somewhere you probably want to start using it. If you want to just view it like a website then just navigate to the index page. If you want to use this in your own script or program then it's very easy to get the info. Here is an example to get the current days timetable then to get the first sessions class.

>>> import requests
>>> headers = {"username": username}
>>> # Or if you want to update the database has well
>>> headers = {"username": username, "password": password, "update":"True"}
>>> url = "http://yoururl/list"
>>> r = requests.post(url=url, headers=headers)
>>> json = r.json()
>>> print(json[0]["session1"]["info"]["class"])

Current options

/list

It returns timetable, classroom, teacher and time. (only meant to be accessed from script)

/list/(day)

Displays a basic list but for a certain day. (only meant to be accessed from script)

/

Displays a form to enter username and password which then displays your timetable in a human readable format.

Development

To use the tests you need to run

sudo pip install -r devrequirements.txt

Then to run tests you run

cd app4flask
tox

app4flask's People

Contributors

foamery avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

john-az1

app4flask's Issues

Issue with loading info only popping up with opening url

when going the the url for /list I get this error

Traceback (most recent call last):
  File "D:\Software\Python 3\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "D:\Software\Python 3\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "D:\Software\Python 3\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "D:\Software\Python 3\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "D:\Software\Python 3\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\Software\Python 3\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "D:/Projects/app4flaskbackend/app4flask.py", line 132, in show_info
    classes.append("<class>" + str(get(today, i, studentnum)) + "</class>")
  File "D:/Projects/app4flaskbackend/app4flask.py", line 121, in get
    parse = jsonstr["class"]
TypeError: 'NoneType' object is not subscriptable

but when I run

show_info(*with args) 

In the script instead of

app.run()

The error doesn't pop up

Getting error 403 when scraping site

getting this error when scraping app4 website

httperror_seek_wrapper: HTTP Error 403: request disallowed by robots.txt

think it might be issue with the app4 website

Week 2 not working

Has of the moment I have no way of finding which Week it is (week 1 or 2) hopefully this will be resolved soon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.