1
0
This commit is contained in:
Jon Michael Aanes 2024-09-27 11:12:14 +02:00
parent 6a78399661
commit dde17e2887
3 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import tempfile
import logging
import requests_cache
import secret_loader
@ -9,6 +10,7 @@ from .favro_fuse import start_favro_fuse
def main():
logging.basicConfig()
secrets = secret_loader.SecretLoader()
favro_org_id = secrets.load_or_fail('FAVRO_ORGANIZATION_ID')
favro_username = secrets.load_or_fail('FAVRO_USERNAME')

View File

@ -77,6 +77,7 @@ class FavroClient:
request = self._get_cards_request(seq_id, todo_list)
# Run query
logger.warning('Sending request: %s', request.url)
response = self.session.send(request)
response.raise_for_status()
json = response.json()
@ -127,12 +128,12 @@ class FavroClient:
'descriptionFormat': 'markdown',
}
logger.warning('Sending body: %s', json_body)
url = URL_UPDATE_CARD.format(card_id=card_id.raw_id)
logger.warning('Sending request: %s', url)
response = self.session.put(
URL_UPDATE_CARD.format(card_id=card_id.raw_id), json=json_body,
url, json=json_body,
)
response.raise_for_status()
logger.warning('Response: %s', response.json())
self._invalidate_cache(card_id)
return Card.from_json(response.json())

View File

@ -3,18 +3,17 @@ import errno
import re
import stat
from collections.abc import Iterator
from logging import getLogger
import fuse
from .favro_client import FavroClient
from .favro_data_model import Card, SeqId
logger = getLogger(__name__)
fuse.fuse_python_api = (0, 2)
hello_path = '/hello'
hello_str = b'Hello World!\n'
class MyStat(fuse.Stat):
def __init__(self):
self.st_mode = 0
@ -90,6 +89,7 @@ class FavroFuse(fuse.Fuse):
return st
def readdir(self, path: str, offset: int) -> Iterator[fuse.Direntry]:
logger.warning('readdir(path=%s, offset=%s)',path, offset)
yield fuse.Direntry('.')
yield fuse.Direntry('..')