2024-09-27 09:12:14 +00:00
|
|
|
import logging
|
2024-09-28 10:54:34 +00:00
|
|
|
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
|
|
|
|
2024-09-28 10:54:34 +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
|
|
|
|
2024-09-26 21:04:26 +00:00
|
|
|
read_only = False
|
|
|
|
|
2024-09-26 21:34:11 +00:00
|
|
|
with tempfile.TemporaryDirectory(prefix='favro_sync_') as tmpdirname:
|
2024-09-28 10:54:34 +00:00
|
|
|
session = requests_cache.CachedSession(
|
|
|
|
tmpdirname + '/http-cache.sqlite',
|
2024-10-01 11:23:22 +00:00
|
|
|
expire_after=300,
|
2024-09-28 10:54:34 +00:00
|
|
|
)
|
2024-09-26 21:08:37 +00:00
|
|
|
|
|
|
|
client = FavroClient(
|
2024-09-28 10:37:19 +00:00
|
|
|
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()
|