Now before uploading tasks to MongoDB check if they have already been uploaded
This commit is contained in:
parent
fef82d882d
commit
0f8a83c9c5
|
@ -12,6 +12,7 @@ from selenium import webdriver
|
|||
from dotenv import load_dotenv
|
||||
import urllib.parse
|
||||
import pymongo
|
||||
import time
|
||||
import os
|
||||
|
||||
#Load .env file
|
||||
|
@ -31,6 +32,7 @@ options.add_argument("--headless") # Headless mode (so you don't see the browser
|
|||
options.add_argument('--disable-gpu') # Disable GPU
|
||||
|
||||
def start_search():
|
||||
time.sleep(7200)
|
||||
global driver
|
||||
driver = webdriver.Firefox(options=options) # Open Firefox and set options
|
||||
driver.get("https://nuvola.madisoft.it/login") # Open Nuvola website
|
||||
|
@ -50,9 +52,9 @@ def start_search():
|
|||
homework_check()
|
||||
|
||||
def homework_check():
|
||||
#Giorno uno
|
||||
day_five.giorno_cinque(driver, collection)
|
||||
day_one.giorno_uno(driver, collection)
|
||||
driver.close()
|
||||
start_search()
|
||||
print("Finish")
|
||||
|
||||
start_search()
|
|
@ -17,6 +17,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -27,11 +28,13 @@ def giorno_cinque(driver, collection):
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": "No school subject", "description": description }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict) # Insert data in MongoDB
|
||||
|
||||
school_subject = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li/h2"))).text) # School subject 1
|
||||
new_school_subject = {"$set": {"School Subject": school_subject}} # Update school subject
|
||||
new_school_subject = {"$set": {"name": school_subject}} # Update school subject
|
||||
collection.update_one(mydict, new_school_subject) # Update school subject
|
||||
try:
|
||||
school_subject_1 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[1]/div/ul/li/p"))).text) # School subject 1
|
||||
|
@ -43,6 +46,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -54,6 +58,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict1) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -65,6 +72,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -76,6 +84,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict2) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -87,6 +98,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -98,6 +110,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict3) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -109,6 +124,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -120,6 +136,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict4) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -131,6 +150,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -142,6 +162,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict5) # Insert data in MongoDB
|
||||
|
||||
except TimeoutException:
|
||||
|
@ -157,6 +180,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -168,6 +192,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict6) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -179,6 +206,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -190,6 +218,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict7) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -201,6 +232,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -212,6 +244,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict8) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -223,6 +258,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -234,6 +270,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict9) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -245,6 +284,7 @@ def giorno_cinque(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -256,6 +296,9 @@ def giorno_cinque(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict10) # Insert data in MongoDB
|
||||
except TimeoutException:
|
||||
WebDriverWait(driver, 250).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div/main/div/div/div[1]/div[1]/div[1]/button[3]"))).click() # Click on next day button
|
|
@ -19,6 +19,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -29,11 +30,13 @@ def giorno_quattro(driver, collection):
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": "No school subject", "description": description }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict) # Insert data in MongoDB
|
||||
|
||||
school_subject = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li/h2"))).text) # School subject 1
|
||||
new_school_subject = {"$set": {"School Subject": school_subject}} # Update school subject
|
||||
new_school_subject = {"$set": {"name": school_subject}} # Update school subject
|
||||
collection.update_one(mydict, new_school_subject) # Update school subject
|
||||
try:
|
||||
school_subject_1 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[1]/div/ul/li/p"))).text) # School subject 1
|
||||
|
@ -45,6 +48,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -56,6 +60,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict1) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -67,6 +74,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -78,6 +86,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict2) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -89,6 +100,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -100,6 +112,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict3) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -111,6 +126,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -122,6 +138,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict4) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -133,6 +152,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -144,6 +164,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict5) # Insert data in MongoDB
|
||||
|
||||
except TimeoutException:
|
||||
|
@ -160,6 +183,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -171,6 +195,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict6) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -182,6 +209,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -193,6 +221,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict7) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -204,6 +235,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -215,6 +247,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict8) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -226,6 +261,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -237,6 +273,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict9) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -248,6 +287,7 @@ def giorno_quattro(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -259,6 +299,9 @@ def giorno_quattro(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict10) # Insert data in MongoDB
|
||||
except TimeoutException:
|
||||
WebDriverWait(driver, 250).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div/main/div/div/div[1]/div[1]/div[1]/button[3]"))).click() # Click on next day button
|
||||
|
|
|
@ -19,6 +19,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -29,7 +30,9 @@ def giorno_uno(driver, collection):
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": "No school subject", "description": description }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict) # Insert data in MongoDB
|
||||
|
||||
school_subject = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li/h2"))).text) # School subject 1
|
||||
|
@ -45,6 +48,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -56,6 +60,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict1) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -67,6 +74,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -78,6 +86,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict2) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -89,6 +100,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -100,6 +112,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict3) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -111,6 +126,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -122,6 +138,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict4) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -133,6 +152,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -144,6 +164,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict5) # Insert data in MongoDB
|
||||
|
||||
except TimeoutException:
|
||||
|
@ -160,6 +183,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -171,6 +195,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict6) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -182,6 +209,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -193,6 +221,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict7) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -204,6 +235,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -215,6 +247,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict8) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -226,6 +261,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -237,6 +273,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict9) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -248,6 +287,7 @@ def giorno_uno(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -259,6 +299,9 @@ def giorno_uno(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict10) # Insert data in MongoDB
|
||||
except TimeoutException:
|
||||
WebDriverWait(driver, 250).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div/main/div/div/div[1]/div[1]/div[1]/button[3]"))).click() # Click on next day button
|
||||
|
|
|
@ -19,6 +19,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -29,11 +30,13 @@ def giorno_tre(driver, collection):
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": "No school subject", "description": description }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict) # Insert data in MongoDB
|
||||
|
||||
school_subject = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li/h2"))).text) # School subject 1
|
||||
new_school_subject = {"$set": {"School Subject": school_subject}} # Update school subject
|
||||
new_school_subject = {"$set": {"name": school_subject}} # Update school subject
|
||||
collection.update_one(mydict, new_school_subject) # Update school subject
|
||||
try:
|
||||
school_subject_1 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[1]/div/ul/li/p"))).text) # School subject 1
|
||||
|
@ -45,6 +48,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -56,6 +60,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict1) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -67,6 +74,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -78,6 +86,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict2) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -89,6 +100,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -100,6 +112,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict3) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -111,6 +126,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -122,6 +138,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict4) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -133,6 +152,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -144,6 +164,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict5) # Insert data in MongoDB
|
||||
|
||||
except TimeoutException:
|
||||
|
@ -160,6 +183,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -171,6 +195,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict6) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -182,6 +209,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -193,6 +221,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict7) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -204,6 +235,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -215,6 +247,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict8) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -226,6 +261,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -237,6 +273,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict9) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -248,6 +287,7 @@ def giorno_tre(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -259,6 +299,9 @@ def giorno_tre(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict10) # Insert data in MongoDB
|
||||
except TimeoutException:
|
||||
WebDriverWait(driver, 250).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div/main/div/div/div[1]/div[1]/div[1]/button[3]"))).click() # Click on next day button
|
||||
|
|
|
@ -19,6 +19,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -29,11 +30,13 @@ def giorno_due(driver, collection):
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": "No school subject", "description": description }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict) # Insert data in MongoDB
|
||||
|
||||
school_subject = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li/h2"))).text) # School subject 1
|
||||
new_school_subject = {"$set": {"School Subject": school_subject}} # Update school subject
|
||||
new_school_subject = {"$set": {"name": school_subject}} # Update school subject
|
||||
collection.update_one(mydict, new_school_subject) # Update school subject
|
||||
try:
|
||||
school_subject_1 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[1]/div/ul/li/p"))).text) # School subject 1
|
||||
|
@ -45,6 +48,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -56,6 +60,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict1) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -67,6 +74,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -78,6 +86,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict2) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -89,6 +100,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -100,6 +112,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict3) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -111,17 +126,21 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
},
|
||||
"description": description_5,
|
||||
"description": description_4,
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict4) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -133,6 +152,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -144,6 +164,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict5) # Insert data in MongoDB
|
||||
|
||||
except TimeoutException:
|
||||
|
@ -160,6 +183,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -171,6 +195,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_1, "description": description_1 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict6) # Insert data in MongoDB
|
||||
|
||||
school_subject_2 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[2]/h2"))).text) # School subject 2
|
||||
|
@ -182,6 +209,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -193,6 +221,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_2, "description": description_2 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict7) # Insert data in MongoDB
|
||||
|
||||
school_subject_3 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[3]/h2"))).text) # School subject 3
|
||||
|
@ -204,6 +235,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -215,6 +247,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_3, "description": description_3 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict8) # Insert data in MongoDB
|
||||
|
||||
school_subject_4 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[4]/h2"))).text) # School subject 4
|
||||
|
@ -226,6 +261,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -237,6 +273,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_4, "description": description_4 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict9) # Insert data in MongoDB
|
||||
|
||||
school_subject_5 = str(WebDriverWait(driver, 250).until(EC.visibility_of_element_located((By.XPATH, "/html/body/div/div/main/div/div[2]/div/ul/li[5]/h2"))).text) # School subject 5
|
||||
|
@ -248,6 +287,7 @@ def giorno_due(driver, collection):
|
|||
"homework": [
|
||||
{
|
||||
"date": {
|
||||
"long date": date,
|
||||
"day": split_date[0],
|
||||
"month": split_date[1],
|
||||
"year": split_date[2],
|
||||
|
@ -259,6 +299,9 @@ def giorno_due(driver, collection):
|
|||
]
|
||||
},
|
||||
|
||||
if collection.find({},{ "_id": 0, "long_date": date ,"name": school_subject_5, "description": description_5 }):
|
||||
print("Homework already in database")
|
||||
else:
|
||||
x = collection.insert_many(mydict10) # Insert data in MongoDB
|
||||
except TimeoutException:
|
||||
WebDriverWait(driver, 250).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div/main/div/div/div[1]/div[1]/div[1]/button[3]"))).click() # Click on next day button
|
||||
|
|
Loading…
Reference in New Issue