summaryrefslogtreecommitdiff
path: root/searx/data/__init__.py
blob: f566dafc2d2cb58f0bfc96592243b006b77c423e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# SPDX-License-Identifier: AGPL-3.0-or-later

import json
from pathlib import Path


__all__ = [
    'ENGINES_LANGUAGES',
    'CURRENCIES',
    'USER_AGENTS',
    'EXTERNAL_URLS',
    'WIKIDATA_UNITS',
    'EXTERNAL_BANGS',
    'OSM_KEYS_TAGS',
    'ahmia_blacklist_loader',
]
data_dir = Path(__file__).parent


def load(filename):
    with open(data_dir / filename, encoding='utf-8') as fd:
        return json.load(fd)


def ahmia_blacklist_loader():
    with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd:
        return fd.read().split()


ENGINES_LANGUAGES = load('engines_languages.json')
CURRENCIES = load('currencies.json')
USER_AGENTS = load('useragents.json')
EXTERNAL_URLS = load('external_urls.json')
WIKIDATA_UNITS = load('wikidata_units.json')
EXTERNAL_BANGS = load('external_bangs.json')
OSM_KEYS_TAGS = load('osm_keys_tags.json')