1
0
favro-sync/favro_sync/__main__.py

36 lines
826 B
Python
Raw Normal View History

2024-09-27 09:12:14 +00:00
import logging
import tempfile
2024-09-26 21:34:11 +00:00
2024-09-26 17:16:53 +00:00
import requests_cache
2024-09-26 14:43:30 +00:00
from . import secrets
2024-09-26 21:08:37 +00:00
from .favro_client import FavroClient, OrganizationId
2024-09-26 16:49:28 +00:00
from .favro_fuse import start_favro_fuse
2024-09-26 14:43:30 +00:00
def main():
2024-09-27 09:12:14 +00:00
logging.basicConfig()
2024-09-26 16:49:28 +00:00
read_only = False
2024-09-26 21:34:11 +00:00
with tempfile.TemporaryDirectory(prefix='favro_sync_') as tmpdirname:
session = requests_cache.CachedSession(
tmpdirname + '/http-cache.sqlite',
2024-10-01 11:23:22 +00:00
expire_after=300,
)
2024-09-26 21:08:37 +00:00
client = FavroClient(
favro_org_id=OrganizationId(secrets.favro_org_id()),
favro_username=secrets.favro_username(),
favro_password=secrets.favro_password(),
2024-09-26 21:08:37 +00:00
session=session,
read_only=read_only,
)
2024-09-26 17:16:53 +00:00
client.check_logged_in()
start_favro_fuse(client)
2024-09-26 14:43:30 +00:00
2024-09-26 21:08:37 +00:00
2024-09-26 14:43:30 +00:00
if __name__ == '__main__':
main()