fix(backend): use certifi for ssl store
All checks were successful
Build extension ZIP / Build extension (push) Successful in 57s
Publish docker image / Publish (push) Successful in 2m37s

This commit is contained in:
Ashhhleyyy 2024-03-11 10:27:34 +00:00
parent 01114692dc
commit 53f257bc4b
Signed by: ash
GPG key ID: 83B789081A0878FB
2 changed files with 5 additions and 1 deletions

View file

@ -1,4 +1,6 @@
import aiohttp
import certifi
import ssl
from datetime import datetime
@ -14,7 +16,8 @@ def reformat_reject_date(date: str):
@router.get('/reject')
async def reject_proxy(date: str, time: str, activity: str, space: str):
"""We proxy the rejectdopamine API to maintain user pivacy (the extension does not transmit user IP addresses to third-party services)"""
async with aiohttp.ClientSession(headers={'User-Agent': 'Mozilla 5.0 (compatible); aci-backend/1.0 (+https://git.ashhhleyyy.dev/ash/aci)'}) as session:
ssl_context = ssl.create_default_context(cafile=certifi.where())
async with aiohttp.ClientSession(headers={'User-Agent': 'Mozilla 5.0 (compatible); aci-backend/1.0 (+https://git.ashhhleyyy.dev/ash/aci)'}, connector=aiohttp.TCPConnector(ssl=ssl_context)) as session:
async with session.get('https://rejectdopamine.com/api/app/active/yrk/cs/1') as resp:
response = await resp.json()
activities = []

View file

@ -20,6 +20,7 @@
fastapi
uvicorn
aiohttp
certifi
python-lsp-server
];
version = self.shortRev or self.dirtyShortDev or "dirty-inputs";