-
Notifications
You must be signed in to change notification settings - Fork 0
ayush2913/IIT-BHU--tpo-notifications
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
IIT BHU TPO Forum Notification =============================== I am trying to make a script to check if any new notifications have arrived on the tpo portal. This is essential because as of now, there is no way to know if any new notice has arrived on tpo forum, other than manually checking it over and over. I have no access to their database and would attempt to do it using some web scripts. Let us see where it goes. Dependencies ============ The following dependecies are to be installed in the linux boxes before getting into the python dependencies 1. python-lxml (sudo apt-get install python-lxml) 2. libpq-dev (debian based) or postgresql-devel (rhel based) for connecting to postgresql database using python 3. python-dev (debian based) or its equivalent in rhel based systems 4. libffi-dev (debian based) or its equivalent in rhel based systems 5. ccze (To beautify logs and export it in HTML) ** Python Dependencies ** 1. Requests - http://docs.python-requests.org/ 2. BeautifulSoup - http://www.crummy.com/software/BeautifulSoup/ 3. APScheduler - https://apscheduler.readthedocs.org 4. peewee - https://peewee.readthedocs.org 5. psycopg2 - https://pypi.python.org/pypi/psycopg2 6. [OPTIONAL] python-crontab - https://pypi.python.org/pypi/python-crontab Before Running ============== In order to prepare the environment for running this application, follow the following steps. 0. Make sure pip is installed. If not, install it using, $ sudo apt-get install python-pip 1. Install virtualenv so that isolated environment can be made available for this application to run in. Do this by, $ sudo pip install virtualenv 2. Make a new virtual environment for this application by running the following in the applications directory $ virtualenv appenv This creates a folder named appenv that acts as the pythonpath for this application. 3. Activate the virtual environment using, $ source appenv/bin/activate A (appenv) in front of the prompt marks success. To deactivate, simply, $ deactivate 4. Install the dependencies of this project as available in the requirements.txt file. Do this by, $ pip install -r requirements.txt Do not use sudo here. You can confirm that everything is installed by looking through the appenv directory. 5. Export required environmental variables - This application uses envronmental variables for important variable. Set these by export commands as below. You can also add these commands to ~/.bashrc so that they are auto exported every time a terminal is opened. $ export TPO_BASEURL='http://url.of.tpo' $ export TPO_PASS='password' $ export TPO_USER='usename' $ export TPO_PB_AUTH='auth_code_op_pushbullet' $ export TPO_PB_CHANNEL='pushbullet channel name' $ export TPO_FORUMID=100 $ export DATABASE_URL=postgres:///$(whoami) The application is now ready to be run. About Postgres ============== The application has support for using postgres database to store its notices. For usage of postgres : 1. export DATABASE_URL pointing to the postgres:// of the database 2. Use _db() functions for interacting with the database. For testing on local system, this works. export DATABASE_URL=postgres:///$(whoami) Deploy ====== This application is currently deployed on Heroku and uses its postgres add-on. It does not support Google App Engine is not possible because of its restriction on writing files. Even though a database can be used, write permission is required to save the html file of the Notice Board. Run ==== For running on a linux box, there are two ways: 1. Using python $ python schedule.py 2. Using bash $ watch -n 0 bash schedule.sh As both of the above commands should run indefinitely, leave it detached on a GNU screen.
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published