INNER CODE UNIT · Python
flush_seen
pluralsh/plural · bin/list_images.py:48
def flush_seen(*_args):
seen_file = Path('./.seen')
with seen_file.open('w') as f:
f.writelines([f"{r}\n" for r in SEEN])
sys.exit(0)
def get_token():
if os.environ.get('PLURAL_ACCESS_TOKEN'):
return os.environ['PLURAL_ACCESS_TOKEN']
with open(expanduser("~/.plural/config.yml")) as f:
data = yaml.load(f, Loader=SafeLoader)
return data["spec"]["token"]
def gql_client():
token = get_token()
return GraphqlClient(endpoint="https://app.plural.sh/gql", headers={"Authorization": f"Bearer {token}"})