def impersonate_with_client_credentials(): credentials = Credentials(client_id='cf79cfbd-ed01-4ae2-93e1-c606a2ebc36f', client_secret='!#?hgbu1*3', become='admin') client = YamcsClient('localhost:8090', credentials=credentials) print('have', client.get_user_info().username) while True: print(client.get_time('simulator')) sleep(1)
def impersonate_with_client_credentials(): credentials = Credentials( client_id="cf79cfbd-ed01-4ae2-93e1-c606a2ebc36f", client_secret="!#?hgbu1*3", become="admin", ) client = YamcsClient("localhost:8090", credentials=credentials) print("have", client.get_user_info().username) while True: print(client.get_time("simulator")) sleep(1)
from __future__ import print_function from time import sleep from yamcs.client import YamcsClient def callback(dt): print('Mission time:', dt) if __name__ == '__main__': client = YamcsClient('localhost:8090') subscription = client.create_time_subscription('simulator', callback) sleep(6) print('-----') # You don't have to use the on_data callback. You could also # directly retrieve the latest state from a local cache: print('Last time from cache:', subscription.time) # But then maybe you don't need a subscription, so do simply: time = client.get_time('simulator') print('Mission time (fresh from server)', time)
from time import sleep from yamcs.client import YamcsClient def callback(dt): print("Mission time:", dt) if __name__ == "__main__": client = YamcsClient("localhost:8090") subscription = client.create_time_subscription("simulator", callback) sleep(6) print("-----") # You don't have to use the on_data callback. You could also # directly retrieve the latest state from a local cache: print("Last time from cache:", subscription.time) # But then maybe you don't need a subscription, so do simply: time = client.get_time("simulator") print("Mission time (fresh from server)", time)
from time import sleep from yamcs.client import YamcsClient from yamcs.kerberos import KerberosCredentials if __name__ == "__main__": client = YamcsClient("localhost:8090", credentials=KerberosCredentials()) while True: print(client.get_time("simulator")) sleep(1)