fix: avoid swallowing cache directory errors

This commit is contained in:
Jacob Molz 2026-05-26 09:47:22 -04:00
parent 4200b5d683
commit 7ca41fa893
No known key found for this signature in database

View file

@ -4,9 +4,10 @@ Loads a PDF document into the library
import argparse
import os
import uuid
import datetime
import requests
from requests.adapters import HTTPAdapter
from urllib3.response import HTTPResponse
from trustgraph.api import Api
from trustgraph.api.types import hash, Uri, Literal, Triple
@ -16,9 +17,6 @@ default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
from requests.adapters import HTTPAdapter
from urllib3.response import HTTPResponse
class FileAdapter(HTTPAdapter):
def send(self, request, *args, **kwargs):
resp = HTTPResponse(body=open(request.url[7:], 'rb'), status=200, preload_content=False)
@ -28,10 +26,7 @@ session = requests.session()
session.mount('file://', FileAdapter())
try:
os.mkdir("doc-cache")
except:
pass
os.makedirs("doc-cache", exist_ok=True)
documents = [
@ -743,4 +738,4 @@ def main():
raise e
if __name__ == "__main__":
main()
main()