Update standalone_twitch_pubsub.py

This commit is contained in:
Alex Orid 2021-04-23 06:40:40 -04:00
parent a5482027f4
commit b91058660a

View File

@ -17,7 +17,7 @@ class Twitch_Pubsub():
self.credential : credentials.Twitch_Credential()
self.twitch : Twitch()
self.pubsub: PubSub()
self.target_scope = [AuthScope.CHANNEL_READ_REDEMPTIONS]
self.target_scope = [AuthScope.CHANNEL_READ_REDEMPTIONS, AuthScope.CHANNEL_MANAGE_REDEMPTIONS]
#Making setup function properly should make all of this run.
def setup(self):
@ -26,6 +26,7 @@ class Twitch_Pubsub():
self.twitch.set_user_authentication(self.credential.pubsub_AccessToken, self.target_scope, self.credential.pubsub_RefreshToken)
def get_tokens(self):
self.twitch.authenticate_app([])
auth = UserAuthenticator(self.twitch, self.target_scope, force_verify=False)
token, refresh_token = auth.authenticate()
print(token)
@ -35,6 +36,7 @@ class Twitch_Pubsub():
def start(self):
self.pubsub = PubSub(self.twitch)
self.pubsub.start()
print("started")
def next(self):
user_id = self.twitch.get_users(logins=['my_username'])['data'][0]['id']
@ -67,5 +69,6 @@ if __name__ == "__main__":
testModule.twitch = Twitch(testModule.credential.pubsub_client_id, testModule.credential.pubsub_secret)
pprint(testModule.twitch.get_users(logins=['thecuriousnerd']))
#testModule.get_tokens()
testModule.setup()
testModule.start()