From 861fc49e74c34c8f04e1495d0e285884b130ab47 Mon Sep 17 00:00:00 2001 From: Jason Lawrence Date: Tue, 10 Nov 2020 22:35:32 -0600 Subject: [PATCH] Allow setting POST headers --- plexauth.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plexauth.py b/plexauth.py index dc749df..f09e8e3 100755 --- a/plexauth.py +++ b/plexauth.py @@ -13,10 +13,11 @@ class PlexAuth(): - def __init__(self, payload, session=None): + def __init__(self, payload, session=None, headers=None): '''Create PlexAuth instance.''' self.client_identifier = str(uuid.uuid4()) self._code = None + self._headers = headers self._identifier = None self._payload = payload self._payload['X-Plex-Client-Identifier'] = self.client_identifier @@ -29,7 +30,7 @@ def __init__(self, payload, session=None): async def initiate_auth(self): '''Request codes needed to create an auth URL. Starts external timeout.''' - async with self._session.post(CODES_URL, data=self._payload) as resp: + async with self._session.post(CODES_URL, data=self._payload, headers=self._headers) as resp: response = await resp.json() self._code = response['code'] self._identifier = response['id'] diff --git a/setup.py b/setup.py index 5a5a731..c37ddde 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ with open('README.md') as f: long_description = f.read() -VERSION="0.0.5" +VERSION="0.0.6" setup( name='plexauth',