Skip to content

Commit

Permalink
fix: specify certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgengaldal committed Jul 23, 2024
1 parent 29841cc commit 13814da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Binary file modified algorithm/requirements.txt
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
from dotenv import load_dotenv
from datetime import datetime, timezone
import os
import certifi

def main():
periods = fetch_periods()


#Sjekker om perioden er før intervjutiden og etter søknadstiden, og returnerer søkere og komitétider dersom det er tilfelle
for period in periods:
periodId = period["_id"]
interview_start = datetime.fromisoformat(period["interviewPeriod"]["start"].replace("Z", "+00:00"))
application_end = datetime.fromisoformat(period["applicationPeriod"]["end"].replace("Z", "+00:00"))

now = datetime.now(timezone.utc)

if interview_start < now and application_end > now:
applicants = fetch_applicants(periodId)
committee_times = fetch_committee_times(periodId)
Expand All @@ -30,7 +30,7 @@ def connect_to_db(collection_name):
mongo_uri = os.getenv("MONGODB_URI")
db_name = os.getenv("DB_NAME")

client = MongoClient(mongo_uri)
client = MongoClient(mongo_uri, tlsCAFile=certifi.where())

db = client[db_name] # type: ignore

Expand Down Expand Up @@ -71,6 +71,5 @@ def fetch_committee_times(periodId):

return committee_times




if __name__ == "__main__":
main()

0 comments on commit 13814da

Please sign in to comment.