Skip to content

Commit

Permalink
Version 0.2 (MAJOR IMPROVEMENTS)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazchanel committed Apr 3, 2023
1 parent 78dcc9a commit 11a4393
Show file tree
Hide file tree
Showing 13 changed files with 455 additions and 155 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
dist
HAC_API.egg-info
src/home_access_center_api.egg-info
src/home_access_center_api.egg-info
src/hacapi.egg-info
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "home-access-center-api"
version = "0.1"
name = "hacapi"
version = "0.2"
authors = [
{ name="Nazchanel", email="[email protected]" },
]
Expand Down
13 changes: 0 additions & 13 deletions src/hacapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
# Importing the modules
# from file_modification import clear_files, returnGradeTables
# from login import login, getTime
# from grades import initializeClasses, returnGrades
# from notification import isUpdated
# from test import userInput

# Initalization
# print("--------------------------------------------\n\tWelcome to the HAC API!\n--------------------------------------------")
# print(" https://github.com/Nazchanel")
# print()
# print("\t Version: 1.0.0")
# print("\t Date: 4/01/2023")
80 changes: 80 additions & 0 deletions src/hacapi/assignments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

import json
import pandas as pd
import session

def returnQuarterAssignmentsHTML(quarter):
session_requests = session.session_requests

urls = "https://hac.friscoisd.org/HomeAccess/Content/Student/Assignments.aspx"

initial_html = session_requests.get(urls, headers=dict(referer=urls))

with open(f'payloads/{quarter}.json', 'r') as file:
json_str = file.read()
json_obj = json.loads(json_str)

specific_quarter = session_requests.post(urls, data=json_obj,headers=dict(referer=urls))

df = pd.read_html(specific_quarter.text)

specific_quarter.html = df.to_html()

index_list = []

for i in range(len(df)):
if len(df[i].columns) == 10:
index_list.append(i)

html_list = []

for i in index_list:
html_list.append(df[i].to_html())

return html_list


def returnQuarterAssignmentsDataFrame(quarter):
session_requests = session.session_requests

urls = "https://hac.friscoisd.org/HomeAccess/Content/Student/Assignments.aspx"

with open(f'payloads/{quarter}.json', 'r') as file:
json_str = file.read()
json_obj = json.loads(json_str)

specific_quarter = session_requests.post(urls, data=json_obj,headers=dict(referer=urls))
df = pd.read_html(specific_quarter.text)

index_list = []
df_list = []

for i in range(len(df)):
if len(df[i].columns) == 10:
index_list.append(i)

for i in index_list:
df_list.append(df[i])

return df_list

def returnCurrentAssignments():
session_requests = session.session_requests
session.return_to_current()

urls = "https://hac.friscoisd.org/HomeAccess/Content/Student/Assignments.aspx"

result = session_requests.get(urls, headers=dict(referer=urls))
df = pd.read_html(result.text)

index_list = []
df_list = []

for i in range(len(df)):
if len(df[i].columns) == 10:
index_list.append(i)

for i in index_list:
df_list.append(df[i])

return df_list
59 changes: 0 additions & 59 deletions src/hacapi/file_modification.py

This file was deleted.

Loading

0 comments on commit 11a4393

Please sign in to comment.