Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)BU
Posts
0
Comments
1
Joined
2 wk. ago

  • Store the access token in an environment variable instead of a file. Not sure which language are you using but for my bot I have this Python code to retrieve the token which is stored in the MASTODON_TOKEN environment var.

     
        
    TOKEN_ENVIRON_VAR = 'MASTODON_TOKEN'
    
    
    def get_auth_token():
        '''Fetches the auth token from the env var.'''
        try:
            token = os.environ[TOKEN_ENVIRON_VAR].strip()
            if not token:
                raise ValueError()
            return token
        except Exception as e:
            logging.error('Unable to get the auth token for Mastodon')
            logging.error(e, exc_info=True)
            sys.exit(-1)