bulk general setup and testing
This commit is contained in:
parent
d2264f98d7
commit
80f8844a58
|
@ -0,0 +1,2 @@
|
|||
config.json
|
||||
*.kdev4
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"token":"access token here, don't share this with anyone",
|
||||
"instance":"https://example.com"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Mastodon.py >= 1.5.1
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue