diff options
Diffstat (limited to 'http_server/src')
| -rw-r--r-- | http_server/src/http_server/__init__.py | 0 | ||||
| -rw-r--r-- | http_server/src/http_server/__main__.py | 33 | ||||
| -rw-r--r-- | http_server/src/http_server/__pycache__/__main__.cpython-314.pyc | bin | 0 -> 1792 bytes |
3 files changed, 33 insertions, 0 deletions
diff --git a/http_server/src/http_server/__init__.py b/http_server/src/http_server/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/http_server/src/http_server/__init__.py diff --git a/http_server/src/http_server/__main__.py b/http_server/src/http_server/__main__.py new file mode 100644 index 00000000..fe32b0f2 --- /dev/null +++ b/http_server/src/http_server/__main__.py @@ -0,0 +1,33 @@ +import uvicorn +import queue +from fastapi import FastAPI +from pydantic import BaseModel + +PORT = 1234 +HOST = "localhost" +APP = FastAPI() + +q = queue.Queue() + + +class Item(BaseModel): + Name: str + Type: str + Timestamp: str + + +@APP.get("/insight") +def read_assets(): + if q.empty(): + return + return q.get_nowait() + + +@APP.post("/insight") +def post_assets(item: Item): + q.put(item) + return item + + +if __name__ == "__main__": + uvicorn.run(APP, host=HOST, port=PORT) diff --git a/http_server/src/http_server/__pycache__/__main__.cpython-314.pyc b/http_server/src/http_server/__pycache__/__main__.cpython-314.pyc Binary files differnew file mode 100644 index 00000000..55032434 --- /dev/null +++ b/http_server/src/http_server/__pycache__/__main__.cpython-314.pyc |
