1
0
favro-sync/favro_sync/__main__.py

34 lines
793 B
Python
Raw Normal View History

2024-09-26 21:08:37 +00:00
2024-09-26 21:34:11 +00:00
import tempfile
2024-09-27 09:12:14 +00:00
import logging
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
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
from . import secrets
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:
2024-09-27 14:13:03 +00:00
session = requests_cache.CachedSession( tmpdirname + '/http-cache.sqlite', expire_after=10,)
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()