diff options
| author | mjkwiatkowski <mati.rewa@gmail.com> | 2026-06-23 13:31:05 +0200 |
|---|---|---|
| committer | mjkwiatkowski <mati.rewa@gmail.com> | 2026-06-23 13:31:05 +0200 |
| commit | 81563cdb647b8de014a59fdc7e17fcd5ebf4be6c (patch) | |
| tree | 631cd8ff1f3f77d29739c7e1a06347a327caa7e7 /http_server/src | |
| parent | ca0c72789ba87791829001d259000b2966d9d6e4 (diff) | |
feat: managed to successfully run experiment I
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 |
