Merge pull request #8 from jon4hz/master

add security code and docker
pull/15/head
Fabian 2020-10-11 19:47:22 +02:00 zatwierdzone przez GitHub
commit 316b17e0e2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 23 dodań i 1 usunięć

11
Dockerfile 100644
Wyświetl plik

@ -0,0 +1,11 @@
FROM python:3.9-alpine
LABEL Auther="jon4hz"
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN apk add gcc python3-dev openssl-dev musl-dev libffi-dev &&\
pip install --no-cache-dir -r requirements.txt
COPY main.py handler.py config.py ./
EXPOSE 80
ENTRYPOINT [ "python", "main.py" ]

Wyświetl plik

@ -10,6 +10,8 @@ whitelisted = [
'buy alert', 'sell alert'
]
sec_code = ''
# Telegram Settings
send_telegram_alerts = False
tg_token = '' # Bot token. Get it from @Botfather

Wyświetl plik

@ -0,0 +1,9 @@
---
version: '3.5'
services:
tradingview-webhook-bot:
build: .
container_name: tradingview-webhook-bot
ports:
- '80:80'
restart: unless-stopped

Wyświetl plik

@ -18,7 +18,7 @@ def webhook():
if request.method == 'POST':
data = request.get_data(as_text=True)
for whitelisted in config.whitelisted:
if whitelisted.lower() in data.lower():
if whitelisted.lower() in data.lower() and config.sec_code in data:
print('[✓]', timestamp, 'Alert Received & Sent!\n>', data)
send_alert(data)
return 'Sent alert', 200