from typing import Optional
import logging
import requests


def check_url(url: str) -> Optional[int]:
    """检查网址是否可以访问

    返回状态码，如果报错则返回 None
    """
    logging.info(f"检查网址 {url}")
    try:
        r = requests.get(url)
        return r.status_code
    except:
        pass