fix: on a mac, aiohttp causes failure due to strict SSL checks

- set ssl to False; see: https://docs.aiohttp.org/en/stable/client_advanced.html#ssl-control-for-tcp-sockets
This commit is contained in:
Ayo Ayco 2024-07-07 12:39:37 +02:00
parent bbc2e8623a
commit 3ec8cc3974

View file

@ -1,6 +1,5 @@
from flask import Blueprint, render_template, current_app from flask import Blueprint, render_template, current_app
import requests import requests
import json
from datetime import datetime from datetime import datetime
import markdown import markdown
import re import re
@ -80,11 +79,12 @@ def api_thread(id):
async def get(url, session): async def get(url, session):
try: try:
async with session.get(url=url) as response: async with session.get(url, ssl=False) as response:
res = await response.json() res = await response.json()
return clean_status(res) return clean_status(res)
except Exception as e: except Exception as e:
print(f"Unable to get url {url} due to {e.__class__}") print(f"Unable to get url {url} due to {e.__class__}")
return {}
def get_status_url(ser, id): def get_status_url(ser, id):
return f'{ser}/api/v1/statuses/{id}' return f'{ser}/api/v1/statuses/{id}'