Code Monkey home page Code Monkey logo

pois-questionnaire-filler's Introduction

POIS-Questionnaire-Filler

A code to fill daily questionnaire for POIS course.

Requirements

  • Selenium
  • Argparse
$ pip install selenium argparse

After downloading chromedriver/geckodriver, follow these steps:

$ chmod +x chromedriver
$ sudo mv chromedriver /usr/local/bin
$ export PATH=$PATH:/usr/local/bin/chromedriver

The above steps are for Google Chrome, replace chromedriver with geckodriver for Firefox browser

Check the installation

$ python
>>> import selenium
>>> from selenium import webdriver
>>> 
>>> 
>>> driver = webdriver.Chrome() # for chrome
>>> driver = webdriver.Firefox() # for firefox

The respective browser should be opened after running above piece of code.

Running the code

$ python pois.py -h

usage: login.py [-h] [-b {c,f}] -u USERNAME -p PASSWORD [-t TYPE] [-o {1,2,3,4,5,6,7,8,9,10}]

POIS Questionnaire Filler

optional arguments:
  -h, --help            show this help message and exit
  -b {c,f}, --browser {c,f}
                        select browser Google Chrome(c)/Firefox(f), by default Chrome
  -u USERNAME, --username USERNAME
                        <name.surname>
  -p PASSWORD, --password PASSWORD
                        <password>
  -t TYPE, --type TYPE  research(r)/students(s) account, by default research(r)
  -o {1,2,3,4,5,6,7,8,9,10}, --option {1,2,3,4,5,6,7,8,9,10}
                        (1) Did Nothing
                        (2) Self discovery 
                        (3) Reading/Learning from some outside source (books, wiki, YouTube etc) 
                        (4) Brainstorming with friends 
                        (5) Intersection of (2) & (3) 
                        (6) Intersection of (2) & (4) 
                        (7) Intersection of (3) & (4) 
                        (8) All of (2), (3) and (4) 
                        (9) Couldn't find time 
                        (10) Not interested in the course
                        
                        By default (1) Did Nothing

For example, to submit (9) Couldn't find time in the form, run the following command:

$ python pois.py -u anchit.gupta -p <password> -o 9

To use firefox browser, run the following command:

$ python pois.py -u anchit.gupta -p <password> -b f -o 9

For students account, run the following command:

$ python pois.py -u name.surname -p <password> -t s -o 9

Finally adding this to cron job

Open crontab file:

$ crontab -e

Add the following line in editor to fill the form everyday at 10pm

0 22 * * * /usr/bin/python3 pois.py -u anchit.gupta -p <password> -o 9

Other examples:

Everyday at 10:45 pm

45 22 * * * <command> 

Every odd day (1) Did Nothing and even day (2) Self discovery at 10pm

0 22 1-31/2 * * /usr/bin/python3 pois.py -u anchit.gupta -p <password> -o 1
0 22 2-31/2 * * /usr/bin/python3 pois.py -u anchit.gupta -p <password> -o 2

To check meaning of custom crontab expression checkout https://crontab.guru/

crontab file

P.S This cronjob works for me, If it does not works for you try this https://pypi.org/project/python-crontab/

pois-questionnaire-filler's People

Contributors

anchit1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.