Browse Source

fixes made to fill_form builder

pull/18/head
mctastic 3 years ago
parent
commit
0f1c6fb65c
2 changed files with 5 additions and 3 deletions
  1. +3
    -1
      scripts/builders.py
  2. +2
    -2
      scripts/controls.py

+ 3
- 1
scripts/builders.py View File

@@ -10,6 +10,7 @@ from mechanicalsoup import StatefulBrowser
from requests import get
from bs4 import BeautifulSoup
sys.path.append('.')
import checks
if sys.version_info[0] < 3:
from cookielib import LWPCookieJar
else:
@@ -38,7 +39,8 @@ def build_timetable(room, week, day, hour):


def fill_form(args):
browser, cookiejar = StatefulBrowser(), LWPCookieJar()
browser = StatefulBrowser()
cookie_jar = LWPCookieJar()
browser.set_cookiejar(cookie_jar)
room, date, from_time, to_time = args[0], args[1].split("/"), args[2][:2] + ":" + args[2][2:], args[3][:2] + ":" + args[3][2:]
day, month, year = date[0], date[1], date[2]


+ 2
- 2
scripts/controls.py View File

@@ -33,7 +33,7 @@ def run_loop(lst, options, details):
status = checks.check_room(url)
get_statuses(status, options, room)

def book_grattan():
def book_grattan(details):
form = builders.fill_form(details)
conf = checks.get_confirmation()
if conf == "y":
@@ -43,7 +43,7 @@ def book_grattan():
print("Form submission withdrawn.")
sys.exit()
def book_computing():
def book_computing(details):
creds = []
user, password, from_who, to_who, message = builders.draft_email(details)
creds = [user, password]


Loading…
Cancel
Save