Add config.py functionality to load api_id, api_hash and bot_token
This commit is contained in:
parent
b16691895f
commit
636abbd606
|
@ -2,3 +2,5 @@
|
|||
*.session-journal
|
||||
downalods/*
|
||||
output/*
|
||||
config.py
|
||||
__pycache__
|
|
@ -6,6 +6,6 @@ RUN apk add --no-cache --virtual temporary python3-dev py3-pip gcc libc-dev && p
|
|||
WORKDIR /2pdf
|
||||
|
||||
COPY main.py /2pdf/
|
||||
COPY 2pdf.session /2pdf/
|
||||
COPY config.py /2pdf/
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
CMD ["python", "main.py"]
|
||||
|
|
|
@ -7,6 +7,8 @@ The unoserver dependency is entirely optional - however it improves theoretical
|
|||
```console
|
||||
git clone https://git.darkn.space/neko/tg2pdf.git
|
||||
cd tg2pdf
|
||||
cp config.py.example config.py
|
||||
nano config.py
|
||||
podman build -t tg2pdf .
|
||||
podman run --name tg2pdf -d tg2pdf:latest
|
||||
```
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
API_ID = ""
|
||||
API_HASH = ""
|
||||
BOT_TOKEN = ""
|
19
main.py
19
main.py
|
@ -6,16 +6,15 @@ from pathlib import Path
|
|||
import shutil
|
||||
import time
|
||||
|
||||
# api_id =
|
||||
#api_hash = ""
|
||||
#bot_token = ""
|
||||
# app = Client(
|
||||
# "2pdf",
|
||||
# api_id=api_id, api_hash=api_hash,
|
||||
# bot_token=bot_token
|
||||
# )
|
||||
|
||||
app = Client("2pdf")
|
||||
import config # import settings from config.py
|
||||
api_id = config.API_ID
|
||||
api_hash = config.API_HASH
|
||||
bot_token = config.BOT_TOKEN
|
||||
app = Client(
|
||||
"2pdf",
|
||||
api_id=api_id, api_hash=api_hash,
|
||||
bot_token=bot_token
|
||||
)
|
||||
|
||||
def validDocument(mime_type):
|
||||
valid_mime_types = [
|
||||
|
|
Loading…
Reference in New Issue