feat: add cli script

This commit is contained in:
tiagovla committed 2022-10-04 02:15:39 -03:00
1 parent 505ce8308f
commit 017ea4f354
5 files changed
+36 -4

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
__version__ = "0.1.0"
__version__ = "0.1.1"
from .client import PPGEE
+30
View 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()
-1
View File
@@ -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)
+4 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ppgee"
version = "0.1.0"
version = "0.1.1"
description = ""
authors = ["tiagovla <[email protected]>"]
@@ -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"
+1 -1
View File
@@ -2,4 +2,4 @@ from ppgee import __version__
def test_version():
assert __version__ == '0.1.0'
assert __version__ == "0.1.1"