Skip to content

Commit

Permalink
add env stuff and post to C
Browse files Browse the repository at this point in the history
  • Loading branch information
FredTheNoob committed Dec 1, 2023
1 parent 10cbc2c commit a73f132
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from socket import timeout
from components import *
from components.EntityLinker import entitylinkerFunc
import json, os, time, string
Expand All @@ -10,17 +9,26 @@
from fastapi import FastAPI, HTTPException, Request, Query
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates

import requests
from dotenv import load_dotenv
templates = Jinja2Templates(directory="public")
app = FastAPI(title="API")

DIRECTORY_TO_WATCH = "data_from_A/"
load_dotenv()

DIRECTORY_TO_WATCH = str(os.getenv("DIRECTORY_TO_WATCH"))
PIPELINE_C_URL = str(os.getenv("PIPELINE_C_URL"))
PIPELINE_C_AUTHORIZATION = str(os.getenv("PIPELINE_C_AUTHORIZATION"))
ACCESS_API_AUTHORIZATION = str(os.getenv("ACCESS_API_AUTHORIZATION"))

async def newFileCreated(file_path: str):
time.sleep(1)
await modifyTxt(file_path)
await processInput(file_path)
outputJSON = await processInput(file_path)

Headers = { "Authorization" : PIPELINE_C_AUTHORIZATION, "Access-Authorization": ACCESS_API_AUTHORIZATION }
status = requests.post(PIPELINE_C_URL, json=outputJSON, headers=Headers)
print(status.text)


dirWatcher = dirWatcher = DirectoryWatcher(
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ pytest-cov==3.0.0
langdetect==1.0.9
httpx
fuzzywuzzy
watchdog
watchdog
python-dotenv

0 comments on commit a73f132

Please sign in to comment.