masto-tools/masto_tools/init.py

15 lines
328 B
Python

from typing import Optional
from masto_tools.config import Config
from mastodon import Mastodon
def log_in(config:Optional[Config]=None) -> Mastodon:
if config is None:
config = Config()
client = Mastodon(
access_token=config.MASTO_TOKEN,
api_base_url=config.MASTO_URL
)
return client