File: config.py

package info (click to toggle)
isbnlib 3.9.3-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 596 kB
  • sloc: python: 4,575; makefile: 4
file content (40 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (2)
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
37
38
39
40
# -*- coding: utf-8 -*-
"""Config file for isbnlib."""

# --> Import only external modules! <--

# Timeouts
URLOPEN_TIMEOUT = 10  # seconds
THREADS_TIMEOUT = 12  # seconds


# URLOPEN_TIMEOUT is used by webservice
def seturlopentimeout(seconds):  # pragma: no cover
    """Set the value of URLOPEN_TIMEOUT (in seconds)."""
    global URLOPEN_TIMEOUT
    URLOPEN_TIMEOUT = seconds


# THREADS_TIMEOUT is a parameter used downstream by Thread calls (see vias.py)
def setthreadstimeout(seconds):  # pragma: no cover
    """Set the value of THREADS_TIMEOUT (in seconds)."""
    global THREADS_TIMEOUT
    THREADS_TIMEOUT = seconds


# API keys
apikeys = {}


def add_apikey(service, apikey):  # pragma: no cover
    """Add API keys."""
    apikeys[service] = apikey


# Generic Options
options = {'VIAS_MERGE': 'parallel'}


def set_option(option, value):  # pragma: no cover
    """Set the value for option."""
    options[option] = value