Update standalone_twitch_pubsub.py
This commit is contained in:
parent
a5482027f4
commit
b91058660a
@ -17,7 +17,7 @@ class Twitch_Pubsub():
|
|||||||
self.credential : credentials.Twitch_Credential()
|
self.credential : credentials.Twitch_Credential()
|
||||||
self.twitch : Twitch()
|
self.twitch : Twitch()
|
||||||
self.pubsub: PubSub()
|
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.
|
#Making setup function properly should make all of this run.
|
||||||
def setup(self):
|
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)
|
self.twitch.set_user_authentication(self.credential.pubsub_AccessToken, self.target_scope, self.credential.pubsub_RefreshToken)
|
||||||
|
|
||||||
def get_tokens(self):
|
def get_tokens(self):
|
||||||
|
self.twitch.authenticate_app([])
|
||||||
auth = UserAuthenticator(self.twitch, self.target_scope, force_verify=False)
|
auth = UserAuthenticator(self.twitch, self.target_scope, force_verify=False)
|
||||||
token, refresh_token = auth.authenticate()
|
token, refresh_token = auth.authenticate()
|
||||||
print(token)
|
print(token)
|
||||||
@ -35,6 +36,7 @@ class Twitch_Pubsub():
|
|||||||
def start(self):
|
def start(self):
|
||||||
self.pubsub = PubSub(self.twitch)
|
self.pubsub = PubSub(self.twitch)
|
||||||
self.pubsub.start()
|
self.pubsub.start()
|
||||||
|
print("started")
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
user_id = self.twitch.get_users(logins=['my_username'])['data'][0]['id']
|
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)
|
testModule.twitch = Twitch(testModule.credential.pubsub_client_id, testModule.credential.pubsub_secret)
|
||||||
pprint(testModule.twitch.get_users(logins=['thecuriousnerd']))
|
pprint(testModule.twitch.get_users(logins=['thecuriousnerd']))
|
||||||
|
|
||||||
|
#testModule.get_tokens()
|
||||||
testModule.setup()
|
testModule.setup()
|
||||||
testModule.start()
|
testModule.start()
|
||||||
Loading…
Reference in New Issue
Block a user