bulk general setup and testing

This commit is contained in:
Sierra 2020-10-14 19:43:37 -04:00
parent d2264f98d7
commit 80f8844a58
4 changed files with 31 additions and 4 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
config.json
*.kdev4

4
example-config.json Normal file
View File

@ -0,0 +1,4 @@
{
"token":"access token here, don't share this with anyone",
"instance":"https://example.com"
}

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Mastodon.py >= 1.5.1

28
tootgopher.py Normal file → Executable file
View File

@ -1,5 +1,25 @@
'''
Documentation, License etc.
#!/usr/bin/env python3
from mastodon import Mastodon
import json
@package tootgopher
'''
# load JSON config file
def load_config() -> dict:
with open('config.json') as f:
config_data = json.load(f)
return config_data
# create Mastodon object using stored API secrets
def gen_masto_obj(config_data: dict) -> Mastodon:
m = Mastodon(
access_token = config_data['token'],
api_base_url = config_data['instance']
)
return m
def main():
config_data = load_config()
m = gen_masto_obj(config_data)
m.toot('Test toot please ignore')
if __name__ == '__main__':
main()