from aws_srp import AWSSRP from subscribe import Subscription import json from id_test_devel import * QUERY_listenOnCollectionStatusEvents = json.dumps({ 'query': """subscription listenOnEvent { listenOnCollectionStatusEvents(channelId:"a9028389dfd904ce51a2aaad93299463286b9ae90c3ee12ec16ea8d3cd37d99e"){ channelId collectionId status } }""" }) # channelId:"a9028389dfd904ce51a2aaad93299463286b9ae90c3ee12ec16ea8d3cd37d99e" QUERY_listenOnCollectionEvents = json.dumps({ 'query': """subscription listen { listenOnCollectionEvents{ id status } }""" }) QUERY_listenOnCollectionEvents_with_params = json.dumps({ 'query': """subscription listen($channelId:ID!) { listenOnCollectionEvents(channelId:$channelId){ channelId collectionId collection { id name status parentId dateCreated type totalProfiles } } }""", 'variables': {"channelId": "c2c39528d40007daacf7b0633f0eaf8307c64b6f0c2021bad30a7a21a"} }) # slava channelID 'variables': {"channelId": "19689a1b5e597736edea63876f74d6818b9883d0642ff1e7d54806874b0d76ce"} # my channelID 'variables': {"channelId": "a9028389dfd904ce51a2aaad93299463286b9ae90c3ee12ec16ea8d3cd37d99e"} # GQL_QUERY = json.dumps( # {"operationName": "AllDatasets", "variables": {}, # "query": "query AllDatasets { allDatasets: getCollections { id parentId name status " # "totalProfiles source dateCreated __typename }}"}) awssrp = AWSSRP(user_name, user_passwd, user_pool_id, app_id, pool_region) sub = Subscription(WSS_URL, API_URL, HOST, QUERY_listenOnCollectionEvents_with_params) while True: tokens = awssrp.authenticate_user() auth_token = tokens["AuthenticationResult"]["AccessToken"] # print(tokens) sub.sub(trace=True, auth_token=auth_token)