<commit_before>from reppy.robots import Robots
from reppy.cache import RobotsCache
import threading
from crawler import config

lock = threading.RLock()

cache = RobotsCache(capacity=500)
headers = {'user-agent': config.user_agent}


def is_crawler_allowed(url):
    try:
        robots_url = Robots.robots_url(url)
        allowed = False
        lock.acquire()
        allowed = cache.allowed(url, config.user_agent)
    except:
        raise
    finally:
        lock.release()

    return allowed<commit_msg>Try to fix reppy exception<commit_after>from reppy.robots import Robots
from reppy.cache import RobotsCache
import threading
from crawler import config

lock = threading.RLock()

cache = RobotsCache(capacity=500)
headers = {'user-agent': config.user_agent}


def is_crawler_allowed(url):
    try:
        robots_url = Robots.robots_url(url)
        allowed = False


        lock.acquire()
        allowed = cache.allowed(url, config.user_agent)
    except:
        pass
    finally:
        lock.release()

    return allowed
{'fraction_non_alphanumeric': 0.08477842003853564, 'fraction_numerical': 0.005780346820809248, 'mean_word_length': 3.139442231075697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5863049', 'n_tokens_mistral': 333, 'n_tokens_neox': 319, 'n_words': 79}