masto-mutuals.py - it now reads a config file.

in-use
Emily Frost 5 years ago
parent 7dbe0f86a5
commit 9d4b8c93ba
Signed by: Emily
GPG Key ID: AA5D42849F1CBDC9

@ -1,10 +1,17 @@
#!/usr/bin/python3 #!/usr/bin/python3
from mastodon import Mastodon from mastodon import Mastodon
import configparser
import xdg.BaseDirectory
config_file_path = '%s/masto-mutuals/config.txt' % xdg.BaseDirectory.xdg_config_home
config = configparser.ConfigParser()
config.read(config_file_path)
# TODO: if config file is empty, this should write defaults into a file.
mastodon = Mastodon( mastodon = Mastodon(
access_token = 'apptoken.secret', #app authtoken access_token = config['ACCOUNT_DATA']['access_token']
api_base_url = 'https://lgbt.io' api_base_url = config['ACCOUNT_DATA']['instance_url']
) )
user_id = mastodon.me()['id'] user_id = mastodon.me()['id']

Loading…
Cancel
Save