Compare commits
4 commits
choose-uui
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 07518a1f8f | |||
| f4159bc30d | |||
| b57546140b | |||
| de8af89d71 |
3 changed files with 20 additions and 9 deletions
13
Dockerfile
13
Dockerfile
|
|
@ -1,10 +1,19 @@
|
|||
FROM python:3
|
||||
FROM python:3.13.11-alpine3.23 AS builder
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
RUN apk add --no-cache gcc g++ musl-dev rust cargo patchelf
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
|
||||
|
||||
FROM python:3.13.11-alpine3.23
|
||||
|
||||
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
|
||||
RUN apk add --no-cache libstdc++
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD [ "python", "-u", "./main.py" ]
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
services:
|
||||
server:
|
||||
build: .
|
||||
env_file: .env
|
||||
|
||||
9
main.py
9
main.py
|
|
@ -51,14 +51,21 @@ class BringPlugin:
|
|||
self.webhook_url = os.getenv("WEBHOOK_URL")
|
||||
self.bring = None
|
||||
self.existing_list = None
|
||||
print(f"email: {self.email}")
|
||||
|
||||
async def grab_items(self, bring_list):
|
||||
"""Grabs the items of the list using the list's uuid"""
|
||||
item_objs = (await self.bring.get_list(bring_list.uuid)).items.purchase
|
||||
bring_list.items = [item.itemId for item in item_objs]
|
||||
bring_list.items = [self.transform_item(item) for item in item_objs]
|
||||
print(f"Successfully fetched items at {datetime.datetime.now().isoformat()}")
|
||||
print(f"Items = {bring_list.items}")
|
||||
|
||||
def transform_item(self, api_item):
|
||||
if api_item.specification:
|
||||
return f"{api_item.itemId} ({api_item.specification})"
|
||||
else:
|
||||
return api_item.itemId
|
||||
|
||||
async def send_list_to_trmnl(self, session, bring_list):
|
||||
"""Sends the list to TRMNL if it has changed"""
|
||||
if self.existing_list == bring_list:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue