Skip to content

Commit

Permalink
Pantry Server Unavailable and TimeZone Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sakmalh committed Sep 15, 2023
1 parent d0c3ccf commit a4b301d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Empty file removed .env
Empty file.
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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 = []
Expand All @@ -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)
Expand Down

0 comments on commit a4b301d

Please sign in to comment.