-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pantry Server Unavailable and TimeZone Fix
- Loading branch information
Showing
2 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import re | ||
from selenium.webdriver.common.by import By | ||
from datetime import datetime | ||
from zoneinfo import ZoneInfo | ||
from utils.text_formatting import text_formatting | ||
from dotenv import load_dotenv | ||
import os | ||
|
@@ -21,7 +22,7 @@ | |
greenAPI = API.GreenApi( | ||
IDINSTANCE, TOKENID | ||
) | ||
pantry = f"https://getpantry.cloud/apiv1/pantry/{PANTRYTOKEN}/basket/Test" | ||
pantry = f"https://api.npoint.io/a2376d48fe134d4592dc" | ||
email = '[email protected]' | ||
|
||
course_pattern = r"^https:\/\/lms\.apiit\.lk\/course\/view" | ||
|
@@ -63,11 +64,11 @@ | |
'Link': assignment, | ||
'Type': 'Normal', | ||
'Due Date': due_date, | ||
'Time Remaining': datetime.strptime(due_date, '%A, %d %B %Y, %I:%M %p') - datetime.now(), | ||
'Time Remaining': datetime.strptime(due_date, '%A, %d %B %Y, %I:%M %p').replace(tzinfo=ZoneInfo('Asia/Kolkata')) - datetime.now(tz=ZoneInfo('Asia/Kolkata')), | ||
'Title': title | ||
} | ||
|
||
if datetime.now() < datetime.strptime(due_date, '%A, %d %B %Y, %I:%M %p'): | ||
if datetime.now(tz=ZoneInfo('Asia/Kolkata')) < datetime.strptime(due_date, '%A, %d %B %Y, %I:%M %p').replace(tzinfo=ZoneInfo('Asia/Kolkata')) : | ||
assignments_details.append(details) | ||
|
||
turnitin_details = [] | ||
|
@@ -80,10 +81,10 @@ | |
'Link': turnit, | ||
'Type': 'Turnitin', | ||
'Due Date': turnitin_row[2].text, | ||
'Time Remaining': datetime.strptime(turnitin_row[2].text, "%d %b %Y - %H:%M") - datetime.now(), | ||
'Time Remaining': datetime.strptime(turnitin_row[2].text, "%d %b %Y - %H:%M").replace(tzinfo=ZoneInfo('Asia/Kolkata')) - datetime.now(tz=ZoneInfo('Asia/Kolkata')), | ||
'Title': turnitin_row[0].text | ||
} | ||
if datetime.now() < datetime.strptime(turnitin_row[2].text, "%d %b %Y - %H:%M"): | ||
if datetime.now(tz=ZoneInfo('Asia/Kolkata')) < datetime.strptime(turnitin_row[2].text, "%d %b %Y - %H:%M").replace(tzinfo=ZoneInfo('Asia/Kolkata')) : | ||
turnitin_details.append(details) | ||
|
||
data = json.loads(requests.get(pantry).text) | ||
|