From cbaaa196da35a264587e0f773917a8bf6d7db4cc Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 17 Sep 2023 14:51:54 -0700 Subject: [PATCH] Add X-Plex-Language header to config (#1241) --- docs/configuration.rst | 4 ++++ plexapi/__init__.py | 1 + plexapi/config.py | 1 + 3 files changed, 6 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 5d2fbcf1..9c283e3b 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -130,6 +130,10 @@ Section [header] Options Header value used for X_PLEX_IDENTIFIER to all Plex server and Plex client requests. This is generally a UUID, serial number, or other number unique id for the device (default: `result of hex(uuid.getnode())`). +**language** + Header value used for X_PLEX_LANGUAGE to all Plex server and Plex client requests. This is an ISO 639-1 + language code (default: en). + **platform** Header value used for X_PLEX_PLATFORM to all Plex server and Plex client requests. Example platforms include: iOS, MacOSX, Android, LG (default: `result of platform.uname()[0]`). diff --git a/plexapi/__init__.py b/plexapi/__init__.py index eefc181d..1d4fb471 100644 --- a/plexapi/__init__.py +++ b/plexapi/__init__.py @@ -30,6 +30,7 @@ X_PLEX_VERSION = CONFIG.get('header.version', VERSION) X_PLEX_DEVICE = CONFIG.get('header.device', X_PLEX_PLATFORM) X_PLEX_DEVICE_NAME = CONFIG.get('header.device_name', uname()[1]) X_PLEX_IDENTIFIER = CONFIG.get('header.identifier', str(hex(getnode()))) +X_PLEX_LANGUAGE = CONFIG.get('header.language', 'en') BASE_HEADERS = reset_base_headers() # Logging Configuration diff --git a/plexapi/config.py b/plexapi/config.py index 8bbf1f31..5cfa74c8 100644 --- a/plexapi/config.py +++ b/plexapi/config.py @@ -63,6 +63,7 @@ def reset_base_headers(): 'X-Plex-Device': plexapi.X_PLEX_DEVICE, 'X-Plex-Device-Name': plexapi.X_PLEX_DEVICE_NAME, 'X-Plex-Client-Identifier': plexapi.X_PLEX_IDENTIFIER, + 'X-Plex-Language': plexapi.X_PLEX_LANGUAGE, 'X-Plex-Sync-Version': '2', 'X-Plex-Features': 'external-media', }