From 926ebb6754183d984feed34529be964206e73410 Mon Sep 17 00:00:00 2001 From: jeanGaston Date: Tue, 30 Jan 2024 08:40:53 +0100 Subject: [PATCH] Update Add base pyhton script for scraper Correction into docker --- DataScraper/DOCKERFILE | 6 +++--- DataScraper/Helloworld.py | 1 - DataScraper/main.py | 16 ++++++++++++++++ docker-compose.yml | 2 -- 4 files changed, 19 insertions(+), 6 deletions(-) delete mode 100644 DataScraper/Helloworld.py create mode 100644 DataScraper/main.py diff --git a/DataScraper/DOCKERFILE b/DataScraper/DOCKERFILE index 6d0d4de..ed36aee 100644 --- a/DataScraper/DOCKERFILE +++ b/DataScraper/DOCKERFILE @@ -5,10 +5,10 @@ FROM python:3.8-slim WORKDIR /app # Copy the script1.py and any other necessary files -COPY ./Helloworld.py /app/ +COPY ./main.py /app/ # Install any dependencies -#RUN pip install --no-cache-dir -r ./requirements.txt +RUN pip install --no-cache-dir bluepy.btle # Set the entry point -CMD ["python", "Helloworld.py"] \ No newline at end of file +CMD ["python", "main.py"] \ No newline at end of file diff --git a/DataScraper/Helloworld.py b/DataScraper/Helloworld.py deleted file mode 100644 index f6552ac..0000000 --- a/DataScraper/Helloworld.py +++ /dev/null @@ -1 +0,0 @@ -print('HelloWorld') diff --git a/DataScraper/main.py b/DataScraper/main.py new file mode 100644 index 0000000..262dc8c --- /dev/null +++ b/DataScraper/main.py @@ -0,0 +1,16 @@ +from bluepy.btle import Scanner + + +scanner = Scanner() +print("Begin device scan") +while True: + devices = scanner.scan(timeout=3.0) + + for device in devices: + print( + f"Device found {device.addr} ({device.addrType}), " + f"RSSI={device.rssi} dB" + ) + for adtype, description, value in device.getScanData(): + print(f" ({adtype}) {description} = {value}") + diff --git a/docker-compose.yml b/docker-compose.yml index 391c406..5817239 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,6 @@ services: build: context: ./WebGui dockerfile: ./DOCKERFILE - ports: - - '80:5000' database: image: 'mariadb:10.3'