mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 21:28:29 +03:00
concludes logging standardization refactor
This commit is contained in:
@@ -6,7 +6,6 @@ import uuid
|
||||
from datetime import datetime, timezone
|
||||
from dateutil.parser import parse as parse_dt
|
||||
|
||||
import requests
|
||||
from auto_archiver.utils.custom_logger import logger
|
||||
|
||||
|
||||
@@ -15,18 +14,6 @@ def mkdir_if_not_exists(folder):
|
||||
os.makedirs(folder)
|
||||
|
||||
|
||||
def expand_url(url):
|
||||
# expand short URL links
|
||||
if "https://t.co/" in url:
|
||||
try:
|
||||
r = requests.get(url)
|
||||
logger.debug(f"Expanded url {url} to {r.url}")
|
||||
return r.url
|
||||
except Exception:
|
||||
logger.error(f"Failed to expand url {url}")
|
||||
return url
|
||||
|
||||
|
||||
def getattr_or(o: object, prop: str, default=None):
|
||||
try:
|
||||
res = getattr(o, prop)
|
||||
|
||||
Reference in New Issue
Block a user