feat: add cli script
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
__version__ = "0.1.0"
|
||||
__version__ = "0.1.1"
|
||||
|
||||
from .client import PPGEE
|
||||
|
||||
30
ppgee/__main__.py
Normal file
30
ppgee/__main__.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import argparse
|
||||
import asyncio
|
||||
from . import PPGEE
|
||||
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(description="Confirm your montly PPGEE attendency")
|
||||
parser.add_argument("username", type=str, help="Your PPGEE's username")
|
||||
parser.add_argument("password", type=str, help="Your PPGEE's password")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
async def cli():
|
||||
args = get_args()
|
||||
user, password = args.username, args.password
|
||||
async with PPGEE(user=user, password=password) as ppgee:
|
||||
frequency_page = await ppgee.frequency()
|
||||
await asyncio.sleep(1)
|
||||
if frequency_page.is_available():
|
||||
print("Attendency confirmed.")
|
||||
await frequency_page.confirm()
|
||||
else:
|
||||
print("Attendency not available yet.")
|
||||
await asyncio.sleep(1)
|
||||
|
||||
def main():
|
||||
asyncio.run(cli())
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -10,7 +10,6 @@ logger = logging.getLogger(__name__)
|
||||
def is_logged_check(method):
|
||||
@wraps(method)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
print("checking if logged in", self.is_logged)
|
||||
if not self.is_logged:
|
||||
raise Exception("You must be logged in to use this method")
|
||||
return method(self, *args, **kwargs)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "ppgee"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = ""
|
||||
authors = ["tiagovla <tiagovla@gmail.com>"]
|
||||
|
||||
@@ -13,6 +13,9 @@ beautifulsoup4 = "^4.11.1"
|
||||
pytest = "^5.2"
|
||||
sendgrid = "^6.9.7"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
ppgee = "ppgee.__main__:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
@@ -2,4 +2,4 @@ from ppgee import __version__
|
||||
|
||||
|
||||
def test_version():
|
||||
assert __version__ == '0.1.0'
|
||||
assert __version__ == "0.1.1"
|
||||
|
||||
Reference in New Issue
Block a user