Skip to content

Commit

Permalink
Allow setting POST headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlawren committed Nov 11, 2020
1 parent 12fd4a5 commit 861fc49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions plexauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 861fc49

Please sign in to comment.