Skip to content

Commit

Permalink
Add pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
captaincolonelfox committed Apr 7, 2024
1 parent 8f1b3b6 commit c87a132
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM python:3.11.8-alpine

WORKDIR /code

COPY requirements.txt .
COPY pyproject.toml requirements.txt ./

RUN pip install -r requirements.txt

COPY app app

CMD [ "python", "app" ]
CMD [ "python", "app/main.py" ]
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![TeleTok](./img/logo.jpg?raw=true)](https://t.me/TeleTockerBot)
[![TeleTok](logo.jpg?raw=true)](https://t.me/TeleTockerBot)

# [TeleTok](https://t.me/TeleTockerBot): Telegram bot for TikTok

Expand All @@ -18,11 +18,12 @@ Built on top of [aiogram](https://github.com/aiogram/aiogram)

(*REQUIRED*)

- API_TOKEN - Bot token from BotFather
- `API_TOKEN` - Bot token from BotFather

(*OPTIONAL*)

- `ALLOWED_IDS` - _JSON int list_. Gives access only to specific user/chat id (default: `[]` (empty list) = all users/chats)
- `ALLOWED_IDS` - _JSON int list_. Gives access only to specific user/chat id (default: `[]` (empty list) = all
users/chats)
- `REPLY_TO_MESSAGE` - _JSON Boolean_. Whether the bot should reply to source message or not (default: `true`)
- `WITH_CAPTIONS` - _JSON Boolean_. Whether the bot should include captions from TikTok in its message (default: `true`)

Expand Down Expand Up @@ -51,5 +52,6 @@ $ docker compose up -d --build
```

# License

MIT

1 change: 0 additions & 1 deletion app/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion app/__main__.py → app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from aiogram import Bot

from settings import settings
from bot import dp
from settings import settings


async def start() -> None:
Expand Down
4 changes: 1 addition & 3 deletions app/tiktok/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ async def get_page_data(self, url: str) -> ItemStruct:
raise RetryingError("no script")

try:
data = script["__DEFAULT_SCOPE__"]["webapp.video-detail"]["itemInfo"][
"itemStruct"
]
data = script["__DEFAULT_SCOPE__"]["webapp.video-detail"]["itemInfo"]["itemStruct"]
except KeyError as ex:
raise RetryingError("no data") from ex

Expand Down
File renamed without changes
44 changes: 44 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[project]
name = "teletok"
version = "5.1.0"
description = "Telegram bot that will download a video by a TikTok url"
authors = [{ name = "Igor Popov", email = "[email protected]" }]
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.11"

dependencies = [
"httpx==0.27.0",
"aiogram==3.4.1",
"beautifulsoup4==4.12.3",
]

[project.optional-dependencies]
dev = [
"black~=24.3.0",
"ruff~=0.3.5",
"mypy~=1.9.0",
]

[tool.black]
target-version = ['py311']
line-length = 100


[tool.mypy]
mypy_path = ["app"]
follow_imports = "silent"
strict = true
disallow_subclassing_any = false
disallow_any_generics = false
ignore_missing_imports = true


[tool.ruff]
line-length = 100
target-version = "py311"
src = ["app"]
lint.ignore = ["D", "S311", "ANN10", "RUF001", "RUF012", "FIX", "TD002", "TD003"]
lint.select = ["ALL"]


4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
httpx==0.27.0
aiogram==3.4.1
beautifulsoup4==4.12.3
-e .

0 comments on commit c87a132

Please sign in to comment.