Rename variable

This commit is contained in:
Tomasz 2021-01-31 22:23:03 +01:00
parent e15a57cbfd
commit 0a8c109138
16 changed files with 161 additions and 161 deletions

View file

@ -1,22 +1,22 @@
import requests import requests
import json import json
def get_attendance(register_id, register_r, oun, s, date): def get_attendance(register_id, students, oun, s, date):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -3,23 +3,23 @@ import requests
import re import re
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
def get_dashboard(register_id, register_r, s, diary_url, symbol): def get_dashboard(register_id, students, s, diary_url, symbol):
cookies = s cookies = s
if diary_url != 'http://cufs.fakelog.cf/': if diary_url != 'http://cufs.fakelog.cf/':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
diary_url = 'http://uonetplus.vulcan.net.pl/' diary_url = 'http://uonetplus.vulcan.net.pl/'
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
diary_url = 'http://uonetplus.fakelog.cf/' diary_url = 'http://uonetplus.fakelog.cf/'

View file

@ -1,22 +1,22 @@
import json import json
import requests import requests
def get_exams(register_id, register_r, oun, s, date, school_year): def get_exams(register_id, students, oun, s, date, school_year):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -1,22 +1,22 @@
import json import json
import requests import requests
def get_grades(register_id, register_r, oun, s): def get_grades(register_id, students, oun, s):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -1,22 +1,22 @@
import requests import requests
import json import json
def get_homeworks(register_id, register_r, oun, s, date, school_year): def get_homeworks(register_id, students, oun, s, date, school_year):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headres = { headres = {

View file

@ -4,7 +4,7 @@ import calendar
import time import time
import re import re
def get_received_messages(register_id, register_r, oun, s, date, school_year, symbol): def get_received_messages(register_id, students, oun, s, date, school_year, symbol):
headers = { headers = {
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Accept': '*/*', 'Accept': '*/*',
@ -21,7 +21,7 @@ def get_received_messages(register_id, register_r, oun, s, date, school_year, sy
return received_messages.json() return received_messages.json()
def get_sent_messages(register_id, register_r, oun, s, date, school_year, symbol): def get_sent_messages(register_id, students, oun, s, date, school_year, symbol):
headers = { headers = {
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Accept': '*/*', 'Accept': '*/*',
@ -38,7 +38,7 @@ def get_sent_messages(register_id, register_r, oun, s, date, school_year, symbol
return sent_messages.json() return sent_messages.json()
def get_deleted_messages(register_id, register_r, oun, s, date, school_year, symbol): def get_deleted_messages(register_id, students, oun, s, date, school_year, symbol):
headers = { headers = {
'Accept-Encoding': 'gzip, deflate, br7', 'Accept-Encoding': 'gzip, deflate, br7',
'Accept': '*/*', 'Accept': '*/*',
@ -55,7 +55,7 @@ def get_deleted_messages(register_id, register_r, oun, s, date, school_year, sym
return deleted_messages.json() return deleted_messages.json()
def get_recipients(register_id, register_r, oun, s, date, school_year, symbol): def get_recipients(register_id, students, oun, s, date, school_year, symbol):
headers = { headers = {
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Accept': '*/*', 'Accept': '*/*',
@ -77,7 +77,7 @@ def get_recipients(register_id, register_r, oun, s, date, school_year, symbol):
return {'addressee': get_addressee.json(), 'unitId': id_jednostka} return {'addressee': get_addressee.json(), 'unitId': id_jednostka}
def send_message(register_id, register_r, oun, s, date, school_year, symbol, send_data): def send_message(register_id, students, oun, s, date, school_year, symbol, send_data):
headers = { headers = {
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Accet': '*/*', 'Accet': '*/*',
@ -92,7 +92,7 @@ def send_message(register_id, register_r, oun, s, date, school_year, symbol, sen
else: else:
link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}' link = f'https://uonetplus-uzytkownik.vulcan.net.pl/{symbol}'
student_data = register_r['data'][0]['UczenNazwisko']+' '+register_r['data'][0]['UczenImie'] student_data = students['data'][0]['UczenNazwisko']+' '+students['data'][0]['UczenImie']
sess = requests.Session() sess = requests.Session()
@ -157,7 +157,7 @@ def send_message(register_id, register_r, oun, s, date, school_year, symbol, sen
return send.json() return send.json()
def get_message_content(register_id, register_r, oun, s, date, school_year, symbol, message_id): def get_message_content(register_id, students, oun, s, date, school_year, symbol, message_id):
headers = { headers = {
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Accept': '*/*', 'Accept': '*/*',

View file

@ -1,22 +1,22 @@
import json import json
import requests import requests
def get_registered_devices(register_id, register_r, oun, s): def get_registered_devices(register_id, students, oun, s):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {
@ -30,22 +30,22 @@ def get_registered_devices(register_id, register_r, oun, s):
return registered.json() return registered.json()
def register_device(register_id, register_r, oun, s): def register_device(register_id, students, oun, s):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -1,22 +1,22 @@
import json import json
import requests import requests
def get_notes(register_id, register_r, oun, s): def get_notes(register_id, students, oun, s):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -1,22 +1,22 @@
import json import json
import requests import requests
def get_school_data(register_id, register_r, oun, s): def get_school_data(register_id, students, oun, s):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -1,22 +1,22 @@
import json import json
import requests import requests
def get_student_data(register_id, register_r, oun, s): def get_student_data(register_id, students, oun, s):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -2,22 +2,22 @@ import json
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
def get_timetable(register_id, register_r, oun, s, date): def get_timetable(register_id, students, oun, s, date):
cookies = s cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458': if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{register_r['data'][0]['IdWychowankowieDziennik']}", "idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
else: else:
cookies.update({ cookies.update({
"biezacyRokSzkolny": f"{register_r['data'][0]['DziennikRokSzkolny']}", "biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{register_r['data'][0]['IdDziennik']}", "idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{register_r['data'][0]['IdPrzedszkoleDziennik']}", "idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{register_r['data'][0]['IdUczen']}" "idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
}) })
headers = { headers = {

View file

@ -52,8 +52,8 @@ def send(url, data, fail, diary_url, symbol, s):
return cookies return cookies
def get_cookies(symbol, oun, s, diary_url): def get_cookies(symbol, oun, s, diary_url):
register_r = s.post(oun+'/UczenDziennik.mvc/Get') students = s.post(oun+'/UczenDziennik.mvc/Get')
register_id = register_r.json()['data'][0]['Okresy'][0]['Id'] register_id = students.json()['data'][0]['Okresy'][0]['Id']
now = datetime.datetime.now() now = datetime.datetime.now()
weekday = now.weekday() weekday = now.weekday()
@ -70,11 +70,11 @@ def get_cookies(symbol, oun, s, diary_url):
date = f'{date}T00:00:00' date = f'{date}T00:00:00'
school_year = register_r.json()['data'][0]['DziennikRokSzkolny'] school_year = students.json()['data'][0]['DziennikRokSzkolny']
data = { data = {
'register_id': register_id, 'register_id': register_id,
'register_r': register_r.json(), 'students': students.json(),
'oun': oun, 'oun': oun,
'date': str(date), 'date': str(date),
'school_year': school_year, 'school_year': school_year,

View file

@ -55,12 +55,12 @@ def grades(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
grades = get_grades(register_id, register_r, oun, s) grades = get_grades(register_id, students, oun, s)
return JsonResponse(grades) return JsonResponse(grades)
else: else:
return redirect('../') return redirect('../')
@ -69,13 +69,13 @@ def timetable(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
date = data['data']['date'] date = data['data']['date']
timetable = get_timetable(register_id, register_r, oun, s, date) timetable = get_timetable(register_id, students, oun, s, date)
return JsonResponse(timetable) return JsonResponse(timetable)
else: else:
return redirect('../') return redirect('../')
@ -84,14 +84,14 @@ def exams(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
date = data['data']['date'] date = data['data']['date']
school_year = data['data']['school_year'] school_year = data['data']['school_year']
exams = get_exams(register_id, register_r, oun, s, date, school_year) exams = get_exams(register_id, students, oun, s, date, school_year)
return JsonResponse(exams) return JsonResponse(exams)
else: else:
return redirect('../') return redirect('../')
@ -100,14 +100,14 @@ def homeworks(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
date = data['data']['date'] date = data['data']['date']
school_year = data['data']['school_year'] school_year = data['data']['school_year']
homeworks = get_homeworks(register_id, register_r, oun, s, date, school_year) homeworks = get_homeworks(register_id, students, oun, s, date, school_year)
return JsonResponse(homeworks) return JsonResponse(homeworks)
else: else:
return redirect('../') return redirect('../')
@ -116,13 +116,13 @@ def attendance(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
date = data['data']['date'] date = data['data']['date']
attendance = get_attendance(register_id, register_r, oun, s, date) attendance = get_attendance(register_id, students, oun, s, date)
return JsonResponse(attendance, safe=False) return JsonResponse(attendance, safe=False)
else: else:
return redirect('../') return redirect('../')
@ -131,12 +131,12 @@ def notes(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
notes = get_notes(register_id, register_r, oun, s) notes = get_notes(register_id, students, oun, s)
return JsonResponse(notes) return JsonResponse(notes)
else: else:
return redirect('../') return redirect('../')
@ -145,12 +145,12 @@ def registered_devices(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
registered = get_registered_devices(register_id, register_r, oun, s) registered = get_registered_devices(register_id, students, oun, s)
return JsonResponse(registered) return JsonResponse(registered)
else: else:
return redirect('../') return redirect('../')
@ -159,12 +159,12 @@ def register_device_(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
register_data = register_device(register_id, register_r, oun, s) register_data = register_device(register_id, students, oun, s)
return JsonResponse(register_data) return JsonResponse(register_data)
else: else:
return redirect('../') return redirect('../')
@ -173,7 +173,7 @@ def received_messages(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
@ -181,7 +181,7 @@ def received_messages(request, *args, **kwargs):
date = data['data']['date'] date = data['data']['date']
school_year = data['data']['school_year'] school_year = data['data']['school_year']
symbol = data['data']['symbol'] symbol = data['data']['symbol']
received_messages = get_received_messages(register_id, register_r, oun, s, date, school_year, symbol) received_messages = get_received_messages(register_id, students, oun, s, date, school_year, symbol)
return JsonResponse(received_messages) return JsonResponse(received_messages)
else: else:
return redirect('../') return redirect('../')
@ -190,7 +190,7 @@ def sent_messages(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
@ -198,7 +198,7 @@ def sent_messages(request, *args, **kwargs):
date = data['data']['date'] date = data['data']['date']
school_year = data['data']['school_year'] school_year = data['data']['school_year']
symbol = data['data']['symbol'] symbol = data['data']['symbol']
sent_messages = get_sent_messages(register_id, register_r, oun, s, date, school_year, symbol) sent_messages = get_sent_messages(register_id, students, oun, s, date, school_year, symbol)
return JsonResponse(sent_messages) return JsonResponse(sent_messages)
else: else:
return redirect('../') return redirect('../')
@ -207,7 +207,7 @@ def deleted_messages(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
@ -215,7 +215,7 @@ def deleted_messages(request, *args, **kwargs):
date = data['data']['date'] date = data['data']['date']
school_year = data['data']['school_year'] school_year = data['data']['school_year']
symbol = data['data']['symbol'] symbol = data['data']['symbol']
deleted_messages = get_deleted_messages(register_id, register_r, oun, s, date, school_year, symbol) deleted_messages = get_deleted_messages(register_id, students, oun, s, date, school_year, symbol)
return JsonResponse(deleted_messages) return JsonResponse(deleted_messages)
else: else:
return redirect('../') return redirect('../')
@ -224,7 +224,7 @@ def recipients(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
@ -232,7 +232,7 @@ def recipients(request, *args, **kwargs):
date = data['data']['date'] date = data['data']['date']
school_year = data['data']['school_year'] school_year = data['data']['school_year']
symbol = data['data']['symbol'] symbol = data['data']['symbol']
recipients = get_recipients(register_id, register_r, oun, s, date, school_year, symbol) recipients = get_recipients(register_id, students, oun, s, date, school_year, symbol)
return JsonResponse(recipients) return JsonResponse(recipients)
else: else:
return redirect('../') return redirect('../')
@ -241,12 +241,12 @@ def school_data(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
school_data = get_school_data(register_id, register_r, oun, s) school_data = get_school_data(register_id, students, oun, s)
return JsonResponse(school_data) return JsonResponse(school_data)
else: else:
return redirect('../') return redirect('../')
@ -255,13 +255,13 @@ def dashboard(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
diary_url = data['data']['diary_url'] diary_url = data['data']['diary_url']
symbol = data['data']['symbol'] symbol = data['data']['symbol']
dashboard = get_dashboard(register_id, register_r, s, diary_url, symbol) dashboard = get_dashboard(register_id, students, s, diary_url, symbol)
return JsonResponse(dashboard) return JsonResponse(dashboard)
else: else:
return redirect('../') return redirect('../')
@ -271,7 +271,7 @@ def send(request, *args, **kwargs):
data = json.loads(request.body) data = json.loads(request.body)
cookies_data = json.loads(data['cookies_data']) cookies_data = json.loads(data['cookies_data'])
register_id = cookies_data['data']['register_id'] register_id = cookies_data['data']['register_id']
register_r = cookies_data['data']['register_r'] students = cookies_data['data']['students']
oun = cookies_data['data']['oun'] oun = cookies_data['data']['oun']
s = cookies_data['data']['s'] s = cookies_data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
@ -280,7 +280,7 @@ def send(request, *args, **kwargs):
school_year = cookies_data['data']['school_year'] school_year = cookies_data['data']['school_year']
symbol = cookies_data['data']['symbol'] symbol = cookies_data['data']['symbol']
send_data = {'data': data['data'], 'subject': data['subject'], 'content': data['content']} send_data = {'data': data['data'], 'subject': data['subject'], 'content': data['content']}
send = send_message(register_id, register_r, oun, s, date, school_year, symbol, send_data) send = send_message(register_id, students, oun, s, date, school_year, symbol, send_data)
return JsonResponse(send, safe=False) return JsonResponse(send, safe=False)
else: else:
return redirect('../') return redirect('../')
@ -290,7 +290,7 @@ def message_content(request, *args, **kwargs):
data = json.loads(request.body) data = json.loads(request.body)
cookies_data = json.loads(data['cookies_data']) cookies_data = json.loads(data['cookies_data'])
register_id = cookies_data['data']['register_id'] register_id = cookies_data['data']['register_id']
register_r = cookies_data['data']['register_r'] students = cookies_data['data']['students']
oun = cookies_data['data']['oun'] oun = cookies_data['data']['oun']
s = cookies_data['data']['s'] s = cookies_data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
@ -299,7 +299,7 @@ def message_content(request, *args, **kwargs):
school_year = cookies_data['data']['school_year'] school_year = cookies_data['data']['school_year']
symbol = cookies_data['data']['symbol'] symbol = cookies_data['data']['symbol']
message_id = data['message_id'] message_id = data['message_id']
content = get_message_content(register_id, register_r, oun, s, date, school_year, symbol, message_id) content = get_message_content(register_id, students, oun, s, date, school_year, symbol, message_id)
return JsonResponse(content, safe=False) return JsonResponse(content, safe=False)
else: else:
return redirect('../') return redirect('../')
@ -308,12 +308,12 @@ def student_data(request, *args, **kwargs):
if request.session.has_key('is_logged'): if request.session.has_key('is_logged'):
data = json.loads(request.body) data = json.loads(request.body)
register_id = data['data']['register_id'] register_id = data['data']['register_id']
register_r = data['data']['register_r'] students = data['data']['students']
oun = data['data']['oun'] oun = data['data']['oun']
s = data['data']['s'] s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8') key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key) s = decrypt_cookies(s, key)
data = get_student_data(register_id, register_r, oun, s) data = get_student_data(register_id, students, oun, s)
return JsonResponse(data) return JsonResponse(data)
else: else:
return redirect('../') return redirect('../')

View file

@ -1,5 +1,5 @@
var cookies_data = JSON.parse(sessionStorage.getItem('cookies_data')); var cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'));
students = cookies_data.data.register_r.data; students = cookies_data.data.students.data;
const displayData = () => { const displayData = () => {
var primary = ''; var primary = '';
@ -28,7 +28,7 @@ const logIn = () => {
studentName = ele[i].value; studentName = ele[i].value;
students.forEach((student) => { students.forEach((student) => {
if (student.UczenPelnaNazwa == studentName) { if (student.UczenPelnaNazwa == studentName) {
cookies_data.data.register_r.data = [student]; cookies_data.data.students.data = [student];
sessionStorage.setItem('cookies_data', JSON.stringify(cookies_data)); sessionStorage.setItem('cookies_data', JSON.stringify(cookies_data));
window.location.href = '/content/'; window.location.href = '/content/';
} }

View file

@ -5,7 +5,7 @@ myStorage = window.sessionStorage;
const studentName = () => { const studentName = () => {
const cookies_data = JSON.parse(sessionStorage.getItem('cookies_data')) const cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'))
name_.innerHTML = cookies_data['data']['register_r']['data'][0]['UczenImie']+' '+cookies_data['data']['register_r']['data'][0]['UczenImie2']+' '+cookies_data['data']['register_r']['data'][0]['UczenNazwisko'] name_.innerHTML = cookies_data['data']['students']['data'][0]['UczenImie']+' '+cookies_data['data']['students']['data'][0]['UczenImie2']+' '+cookies_data['data']['students']['data'][0]['UczenNazwisko']
}; };
const studentEmail = () => { const studentEmail = () => {

View file

@ -39,14 +39,14 @@ class TestViews(TestCase):
self.assertEquals(response.status_code, 200) self.assertEquals(response.status_code, 200)
students = cookies_data['data']['register_r']['data'] students = cookies_data['data']['students']['data']
#JAN #JAN
jan_data = students[0] jan_data = students[0]
cookies_data['data']['register_r']['data'] = [jan_data] cookies_data['data']['students']['data'] = [jan_data]
get_data_test(self.client, cookies_data, self.assertEquals) get_data_test(self.client, cookies_data, self.assertEquals)
#JOANNA #JOANNA
joanna_data = students[3] joanna_data = students[3]
cookies_data['data']['register_r']['data'] = [joanna_data] cookies_data['data']['students']['data'] = [joanna_data]
get_data_test(self.client, cookies_data, self.assertEquals) get_data_test(self.client, cookies_data, self.assertEquals)
log_out_test(self.client, self.assertEquals) log_out_test(self.client, self.assertEquals)