Debian Codegraph @

jellyfin_apiclient_python/configuration.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 ''' This will hold all configs from the client.
4 Configuration set here will be used for the HTTP client.
5 '''
6
7 #################################################################################################
8
9 import logging
10
11 #################################################################################################
12
13 DEFAULT_HTTP_MAX_RETRIES = 3
14 DEFAULT_HTTP_TIMEOUT = 30
15 LOG = logging.getLogger('JELLYFIN.' + __name__)
16
17 #################################################################################################
18
19
20 class Config(object):
21
22 def __init__(self):
23
24 LOG.debug("Configuration initializing...")
25 self.data = {}
26 self.http()
27
28 def app(self, name, version, device_name, device_id, capabilities=None, device_pixel_ratio=None):
29
30 LOG.debug("Begin app constructor.")
31 self.data['app.name'] = name
32 self.data['app.version'] = version
33 self.data['app.device_name'] = device_name
34 self.data['app.device_id'] = device_id
35 self.data['app.capabilities'] = capabilities
36 self.data['app.device_pixel_ratio'] = device_pixel_ratio
37 self.data['app.default'] = False
38
39 def auth(self, server, user_id, token=None, ssl=None):
40
41 LOG.debug("Begin auth constructor.")
42 self.data['auth.server'] = server
43 self.data['auth.user_id'] = user_id
44 self.data['auth.token'] = token
45 self.data['auth.ssl'] = ssl
46
47 def http(self, user_agent=None, max_retries=DEFAULT_HTTP_MAX_RETRIES, timeout=DEFAULT_HTTP_TIMEOUT):
48
49 LOG.debug("Begin http constructor.")
50 self.data['http.max_retries'] = max_retries
51 self.data['http.timeout'] = timeout
52 self.data['http.user_agent'] = user_agent