Fix oauth typo

This commit is contained in:
Alex Vanin 2021-05-16 12:06:28 +03:00
parent b37827b91d
commit 7d31d9f996
3 changed files with 12 additions and 12 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
__pycache__ __pycache__
*.swp *.swp
.token .token
.oath .oauth
.secret .secret
server.conf server.conf
.*.log .*.log

View file

@ -13,8 +13,8 @@ class FleastServer(object):
try: try:
with open('.token', 'r') as reader: with open('.token', 'r') as reader:
self.twitch_token = reader.read().strip() self.twitch_token = reader.read().strip()
with open('.oath', 'r') as reader: with open('.oauth', 'r') as reader:
self.oath_token = reader.read().strip() self.oauth_token = reader.read().strip()
with open('./web/fl.html', 'r') as reader: with open('./web/fl.html', 'r') as reader:
self.index_page = reader.read() self.index_page = reader.read()
with open('./web/fl_template_main.html', 'r') as reader: with open('./web/fl_template_main.html', 'r') as reader:
@ -23,7 +23,7 @@ class FleastServer(object):
self.templ_stream = reader.read() self.templ_stream = reader.read()
with open('./web/fl_template_lang.html', 'r') as reader: with open('./web/fl_template_lang.html', 'r') as reader:
self.templ_lang = reader.read().splitlines() self.templ_lang = reader.read().splitlines()
self.client = TwitchClient(self.twitch_token, self.oath_token, freq=1) self.client = TwitchClient(self.twitch_token, self.oauth_token, freq=1)
except: except:
print("Cannot read token for twitch app or templates, abort.") print("Cannot read token for twitch app or templates, abort.")
exit(1) exit(1)

View file

@ -6,15 +6,15 @@ from urllib.parse import quote
class TwitchClient: class TwitchClient:
def __init__(self, token, oath, freq=2): def __init__(self, token, oauth, freq=2):
self.token = token self.token = token
self.oath = oath self.oauth = oauth
self.lock = threading.Lock() self.lock = threading.Lock()
self.header_v5 = {'Client-ID': self.token, self.header_v5 = {'Client-ID': self.token,
'Authorization': 'Bearer ' + self.oath, 'Authorization': 'Bearer ' + self.oauth,
'Accept': 'application/vnd.twitchtv.v5+json'} 'Accept': 'application/vnd.twitchtv.v5+json'}
self.header_v6 = {'Client-ID': self.token, 'Authorization': 'Bearer ' + self.oath} self.header_v6 = {'Client-ID': self.token, 'Authorization': 'Bearer ' + self.oauth}
self.urlbase_v5 = 'https://api.twitch.tv/kraken' self.urlbase_v5 = 'https://api.twitch.tv/kraken'
self.urlbase_v6 = 'https://api.twitch.tv/helix' self.urlbase_v6 = 'https://api.twitch.tv/helix'