Skip to content

Commit ca5f354

Browse files
authored
Merge pull request #26 from ttrei/bugfix/auth_error
Do not use OAuth token for video-by-id queries
2 parents b40ebd6 + 8155ca7 commit ca5f354

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

resources/lib/twitch/api/v5/videos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# required scope: none
1313
@query
1414
def by_id(video_id):
15-
q = Qry('videos/{video_id}')
15+
q = Qry('videos/{video_id}', use_token=False)
1616
q.add_urlkw(keys.VIDEO_ID, video_id)
1717
return q
1818

resources/lib/twitch/queries.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def execute(self):
105105

106106

107107
class ApiQuery(JsonQuery):
108-
def __init__(self, path, headers={}, data={}, method=methods.GET):
108+
def __init__(self, path, headers={}, data={}, use_token=True, method=methods.GET):
109109
headers.setdefault('Client-ID', CLIENT_ID)
110-
if OAUTH_TOKEN:
110+
if use_token and OAUTH_TOKEN:
111111
headers.setdefault('Authorization', 'OAuth {access_token}'.format(access_token=OAUTH_TOKEN))
112112
super(ApiQuery, self).__init__(_kraken_baseurl, headers, data, method)
113113
self.add_path(path)
@@ -144,8 +144,8 @@ def __init__(self, path, headers={}, data={}, method=methods.PUT):
144144

145145

146146
class V5Query(ApiQuery):
147-
def __init__(self, path, method=methods.GET):
148-
super(V5Query, self).__init__(path, _v5_headers, method=method)
147+
def __init__(self, path, use_token=True, method=methods.GET):
148+
super(V5Query, self).__init__(path, _v5_headers, use_token=use_token, method=method)
149149

150150

151151
def assert_new(d, k):

0 commit comments

Comments
 (0)