Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ six==1.11.0
tabulate==0.8.2
urllib3==1.24.1
Werkzeug==0.14.1
keyring==17.1.1
2 changes: 1 addition & 1 deletion source/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from source.cli import attendance

if __name__ == '__main__':
attendance()
attendance()
19 changes: 15 additions & 4 deletions source/cli.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import click
import keyring
import getpass
from source.scrapper import attempt
from tabulate import tabulate

@click.command()
@click.option('-r', '--roll', prompt='Roll Number', help='Enter the Roll Number for ERP Login.')
@click.password_option('-p', '--password', prompt=True, hide_input=True, confirmation_prompt=False,
help='Enter Password for ERP Login.')
def attendance(roll, password):
def attendance(roll):
"""
Fetch attendance from ERP and Pretty Print it on Terminal.
Get the credentials first
"""
password = keyring.get_password('ERP', roll)
if password == None:
password = getpass.getpass("Password: ")
ans = input("Do you want to store your password?(y/N)")
if ans=='y':
keyring.set_password('ERP', roll, password)


# Fetch attendance from ERP and Pretty Print it on Terminal.

response = attempt(roll, password)

if not response:
click.secho('Invalid Credentials, Login failed.', fg='red', bold=True)
else:
Expand Down