Compare commits

..

No commits in common. "9e8d05fc90096796b3d5605dc4e56d26ac3ccd64" and "730d69f2ac1399935b70dc45df3575b44402f7f9" have entirely different histories.

3 changed files with 5 additions and 5 deletions

View File

@ -73,8 +73,8 @@ class ChatProcess(Process, ABC):
def run(self): def run(self):
try: try:
while True:
timeout = 0 timeout = 0
while True:
response = self.loop(self._next_state) response = self.loop(self._next_state)
if response is None or type(response) is int or type(response) is float: if response is None or type(response) is int or type(response) is float:
timeout = response timeout = response

View File

@ -167,9 +167,9 @@ class YoutubeLiveProcess(ChatProcess):
url = f"{self._client_secrets['auth_uri']}?{param_str}" url = f"{self._client_secrets['auth_uri']}?{param_str}"
webbrowser.open(url) webbrowser.open(url)
def setup_oauth_consent(self, consent_code): def setup_oauth_consent(self):
response = requests.post(YoutubeLiveProcess.GOOGLE_OAUTH_TOKEN_URL, data={ response = requests.post(YoutubeLiveProcess.GOOGLE_OAUTH_TOKEN_URL, data={
'code': consent_code, 'code': self._consent_code,
'client_id': self._client_secrets['client_id'], 'client_id': self._client_secrets['client_id'],
'client_secret': self._client_secrets['client_secret'], 'client_secret': self._client_secrets['client_secret'],
'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob',
@ -180,7 +180,7 @@ class YoutubeLiveProcess(ChatProcess):
with open('refresh_token.secret', 'w') as f: with open('refresh_token.secret', 'w') as f:
f.write(auth['refresh_token']) f.write(auth['refresh_token'])
self._access_token = auth['access_token'] self._access_token = auth['access_token']
self._refresh_token = auth['refresh_token'] self._access_token = auth['refresh_token']
def get_fresh_access_token(self): def get_fresh_access_token(self):
response = requests.post(YoutubeLiveProcess.GOOGLE_OAUTH_TOKEN_URL, data={ response = requests.post(YoutubeLiveProcess.GOOGLE_OAUTH_TOKEN_URL, data={

View File

@ -32,7 +32,7 @@ if __name__ == '__main__':
if process.control_pipe.poll(): if process.control_pipe.poll():
chat_control_msg = process.control_pipe.recv() chat_control_msg = process.control_pipe.recv()
if chat_control_msg == YoutubeLive.CONTROL_MESSAGES.NEEDS_OAUTH_CONSENT_TOKEN: if chat_control_msg == YoutubeLive.CONTROL_MESSAGES.NEEDS_OAUTH_CONSENT_TOKEN:
code = input('Allow access in your browser and paste response code here: ') code = input('Paste response code here: ')
process.control_pipe.send({ process.control_pipe.send({
'type': YoutubeLive.CONTROL_MESSAGES.OAUTH_CONSENT_TOKEN, 'type': YoutubeLive.CONTROL_MESSAGES.OAUTH_CONSENT_TOKEN,
'token': code 'token': code