Skip to content

Commit 0a3d1d6

Browse files
committed
add authorization header and oauth token
1 parent 1af566f commit 0a3d1d6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

resources/lib/twitch/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
VERSION = '1.3.0'
44
CLIENT_ID = ''
5+
OAUTH_TOKEN = ''

resources/lib/twitch/queries.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from six.moves.urllib.parse import urljoin
44

5-
from twitch import CLIENT_ID
5+
from twitch import CLIENT_ID, OAUTH_TOKEN
66
from twitch.exceptions import ResourceUnavailableException
77
from twitch.logging import log
88
from twitch.scraper import download, get_json
@@ -81,19 +81,23 @@ def execute(self):
8181
class ApiQuery(JsonQuery):
8282
def __init__(self, path, headers={}):
8383
headers.setdefault('Client-Id', CLIENT_ID)
84+
headers.setdefault('Authorization', 'OAuth {access_token}'.format(access_token=OAUTH_TOKEN))
8485
super(ApiQuery, self).__init__(_kraken_baseurl, headers)
8586
self.add_path(path)
8687

8788

8889
class HiddenApiQuery(JsonQuery):
8990
def __init__(self, path, headers={}):
9091
headers.setdefault('Client-Id', CLIENT_ID)
92+
headers.setdefault('Authorization', 'OAuth {access_token}'.format(access_token=OAUTH_TOKEN))
9193
super(HiddenApiQuery, self).__init__(_hidden_baseurl, headers)
9294
self.add_path(path)
9395

9496

9597
class UsherQuery(DownloadQuery):
9698
def __init__(self, path, headers={}):
99+
headers.setdefault('Client-Id', CLIENT_ID)
100+
headers.setdefault('Authorization', 'OAuth {access_token}'.format(access_token=OAUTH_TOKEN))
97101
super(UsherQuery, self).__init__(_usher_baseurl, headers)
98102
self.add_path(path)
99103

0 commit comments

Comments
 (0)