Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
74b9357
add return format error
minto1226 Jul 8, 2025
9c5c309
add error handle for
minto1226 Jul 22, 2025
f55d0df
fix: move the workflows folder under correct place
torrid-fish Oct 26, 2025
3e50401
build: move ruff, mypy, pyyaml, toml to dev group
torrid-fish Oct 26, 2025
b78a71d
docs: add check the project section in README
torrid-fish Oct 26, 2025
e185e88
Copy usage_query.py
Koios1143 Jul 4, 2025
1401dad
Use Router instead of APP, add router into main
Koios1143 Jul 4, 2025
1efeb96
Add function that can get "headword_id" of searching words, fix nlb_s…
wade00754 Jul 10, 2025
e5301e2
Update get_id() to support more searching ways
wade00754 Jul 12, 2025
91f90bc
Add test codes for NLT
wade00754 Jul 12, 2025
30b5ef6
Add new api that can let users to get search result first
wade00754 Jul 12, 2025
b45597e
Refactors API to separate headword search and ID details endpoints
wade00754 Jul 12, 2025
a62f497
Add get URL api
wade00754 Jul 12, 2025
f8c46a9
Update requirements
wade00754 Jul 13, 2025
0ec45b7
Add vercel.json for deploy on vercel
Koios1143 Jul 4, 2025
91ebf0b
Add render.yaml for deploy on render
Koios1143 Jul 4, 2025
2c29853
Simply put, it returns the query URL.
wade00754 Jul 13, 2025
5f3e09d
Add dict query into router
Koios1143 Jul 14, 2025
06e501f
Solve CORS issue
Koios1143 Jul 21, 2025
2ae5dc9
Add 'word' in URLResponse
wade00754 Jul 21, 2025
26b769d
Send query to OJAD without filtering
Koios1143 Jul 19, 2025
c457243
Add error handling
Koios1143 Jul 21, 2025
63f54a2
fix: Escape symbols properly and add exception control
Koios1143 Jul 24, 2025
d042ddd
build: deploy to Heroku
wade00754 Aug 2, 2025
5c91f0a
Fix not responding with subword bug
Koios1143 Sep 4, 2025
fa0f5b9
Modify to fit the new API response norm
Koios1143 Sep 7, 2025
3271f66
Fix OJAD kata to hira issue
Koios1143 Sep 7, 2025
ac34d1c
[Fix] resolve punctutation errors
Koios1143 Sep 8, 2025
142025b
feat: Add basic API functionality (sentence_query + dict_query)
Franky-Hsiao Sep 18, 2025
56aca6e
feat: Add error code response
Franky-Hsiao Sep 19, 2025
b8092f7
fix: Fix parsing error on line 77 (soup.select tr.sense)
Franky-Hsiao Sep 19, 2025
66cf66b
fix: Adding SentenceQuery into api interface
Koios1143 Sep 22, 2025
9b46c94
docs: Improve function documentation
Franky-Hsiao Sep 23, 2025
e39de1e
build(requirements)!: update dependencies for the upcoming asynchrono…
wade00754 Oct 19, 2025
bac9fb2
chore: add pr template and `CODEOWNERS` #14
wade00754 Oct 25, 2025
2796999
perf: move to uv, add sharing httpx client and refactor `usage_query`…
wade00754 Oct 25, 2025
3525fd6
build: update `uv.lock` (#16)
wade00754 Oct 26, 2025
7e42162
feat: add PR check workflow for CI/CD (#17)
torrid-fish Oct 26, 2025
4d03001
perf: add aiohttp and asyncio
minto1226 Oct 27, 2025
c3749b0
add return format error
minto1226 Jul 8, 2025
4ed7b5d
add error handle for
minto1226 Jul 22, 2025
6e2eb90
perf: add aiohttp and asyncio
minto1226 Oct 27, 2025
d7aad08
revert: return to path version
minto1226 Oct 27, 2025
873028d
revert: return to path version
minto1226 Oct 27, 2025
9d43c57
feat: add code from auto-cicd
minto1226 Oct 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv sync
uv pip install ruff mypy pyyaml toml

- name: Check for merge conflicts
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.venv
__pycache__/
secret.yaml
secret.yaml
.pre-commit-config.yaml
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# API-tools

> [!WARNING]
>
>
> This project is still under development!

This is a repository that implement several API interfaces for Discord BOT and web interface.
Expand All @@ -14,7 +14,7 @@ Currently we have 2 implemented APIs
5. Sentence Query API

> [!NOTE]
>
>
> The following document is only for developer, we will use Swagger UI to generate official API document.

1. Mark Accent
Expand All @@ -24,7 +24,7 @@ Currently we have 2 implemented APIs

`https://{TODO}/api/MarkAccent/`
- **Request Parameter (POST)**

> Note that we only accept POST request

| Parameter | Type | Explanation |
Expand All @@ -40,7 +40,7 @@ Currently we have 2 implemented APIs
```

- **Respond Parameter**

| Parameter | Type | Explanation |
| --------------- | ------ | ------------ |
| status | int | status code [Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) |
Expand Down Expand Up @@ -136,7 +136,7 @@ Currently we have 2 implemented APIs

`https://{TODO}/api/MarkFurigana/`
- **Request Parameter (POST)**

> Note that we only accept POST request

| Parameter | Type | Explanation |
Expand All @@ -150,7 +150,7 @@ Currently we have 2 implemented APIs
"text": "漢字かな交じり文"
}
```

- **Respond Parameter**

| Parameter | Type | Explanation |
Expand Down Expand Up @@ -249,4 +249,15 @@ async def foo(
...
except httpx.HTTPError as e:
...
```
```


## Check the project
Since the package of ruff and mypy are already installed in dev group,
one can directly execute the following command to format and check the project:
```bash
ruff format . --check # Check format
ruff check . # Check linter
mypy . # Check type
```
For more detailed setting with IDE (e.g. VScode), please refer to our manul.
1 change: 0 additions & 1 deletion api/furigana_marker.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,3 @@ def mark_furigana(request: Request):
status=200,
result=parsed_result
).model_dump()

24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,27 @@ dependencies = [
"requests>=2.32.5",
"uvicorn>=0.38.0",
]

[dependency-groups]
dev = [
"mypy>=1.18.2",
"pyyaml>=6.0.3",
"ruff>=0.14.2",
"toml>=0.10.2",
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["E", "F", "N"]

[tool.mypy]
strict = true
namespace_packages = true
warn_unused_ignores = false
ignore_missing_imports = true
267 changes: 267 additions & 0 deletions tall ruff mypy
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
commit 4d03001e21b65bd836cf00e9907b13c9488823a2 (HEAD -> furigana-marker-api, origin/furigana-marker-api)
Author: minto <chrischris911226@gmail.com>
Date: Mon Oct 27 15:47:55 2025 +0800

perf: add aiohttp and asyncio

commit 7e42162294ee3586fd1f6fa3de14ea690cdbaa22
Author: WU, KUAN-TING <92087101+torrid-fish@users.noreply.github.com>
Date: Sun Oct 26 19:51:25 2025 +0800

feat: add PR check workflow for CI/CD (#17)

commit 3525fd6ed5d8ae0be9756c1f774142a57326569b
Author: Wei De Chien <72686306+wade00754@users.noreply.github.com>
Date: Sun Oct 26 13:53:28 2025 +0800

build: update `uv.lock` (#16)

commit 27969998fc28fe1399e64814e45a85d3117898b7
Author: Wei De Chien <72686306+wade00754@users.noreply.github.com>
Date: Sun Oct 26 00:19:03 2025 +0800

perf: move to uv, add sharing httpx client and refactor `usage_query` to async (#15)

* build(requirements): update dependencies and add uv

Change `aiohttp` to `httpx`

Add `pyproject.toml` and `uv.lock` for `uv`.

* chore: update `CODEOWNERS`

* refactor(main): add doc strings and format with ruff

* feat: add `lifespan` and `get_http_client` fuctions

* style(usage_query): format with ruff

* fix(lifespan): set timeout for `httpx.AsyncClient` to 10 seconds

* perf: refactor `get_headwords`, `get_urls`, and `get_id_details` to use `httpx.AsyncClient` for asynchronous requests

* docs: update README to enhance setup instructions

* build: remove `requirements.txt` and update python version in `pyproject.toml`

commit bac9fb254c29a6e86b9b54a75369df7f5030b336
Author: Wei De Chien <72686306+wade00754@users.noreply.github.com>
Date: Sat Oct 25 13:22:17 2025 +0800

chore: add pr template and `CODEOWNERS` #14

chore: add pr template and `CODEOWNERS`

commit e39de1ec77f9e955e45e371fb1bf781a64939ca5
Author: Wei De Chien <72686306+wade00754@users.noreply.github.com>
Date: Sun Oct 19 20:16:14 2025 +0800

build(requirements)!: update dependencies for the upcoming asynchronous fix (#12)

* build(requirements)!: keep packages that are being used only

Comment out unused packages with two "#" and dependencies of packages
that are being used with one "#".

BREAKING CHANGE: remove `httptools`, `python-dotenv`, `uvloop`,
`watchfiles`, and `websockets` from `requirements.txt`

* build(requirements): add `aiohttp` for upcoming asynchronous fix

commit 9b46c94c891d1be775fa2f15c9dda37b0024a012
Author: Franky_Hsiao <franky20030725@gmail.com>
Date: Tue Sep 23 18:47:55 2025 +0800

docs: Improve function documentation

commit 66cf66bfc99c94494da54c056d64f3f0ff804bcb
Author: Koios <ken1357924681010@gmail.com>
Date: Mon Sep 22 14:32:21 2025 +0800

fix: Adding SentenceQuery into api interface

commit b8092f768ec45905761534ee4e643fb6b364282c
Author: Franky_Hsiao <franky20030725@gmail.com>
Date: Fri Sep 19 10:11:12 2025 +0800

fix: Fix parsing error on line 77 (soup.select tr.sense)

commit 56aca6e0d2b88c394ad3990fbdfc99befd613495
Author: Franky_Hsiao <franky20030725@gmail.com>
Date: Fri Sep 19 10:04:46 2025 +0800

feat: Add error code response

commit 142025b790918e3fc5cd5299c89237eb45605c99
Author: Franky_Hsiao <franky20030725@gmail.com>
Date: Fri Sep 19 00:45:21 2025 +0800

feat: Add basic API functionality (sentence_query + dict_query)

commit ac34d1c4526de5f6fc470b4c28b8a680018b273e
Author: Koios <ken1357924681010@gmail.com>
Date: Mon Sep 8 14:41:39 2025 +0800

[Fix] resolve punctutation errors

commit 3271f66173a6ae876511dfaf3c10ccd29b2c5cd9
Author: Koios <ken1357924681010@gmail.com>
Date: Sun Sep 7 21:17:43 2025 +0800

Fix OJAD kata to hira issue

commit fa0f5b97ed8b302aa7c5bff646de83c462f4237d
Author: Koios <ken1357924681010@gmail.com>
Date: Sun Sep 7 15:45:16 2025 +0800

Modify to fit the new API response norm

commit 5c91f0aa67c44b7b6eb001902a693132377e6ed9
Author: Koios <ken1357924681010@gmail.com>
Date: Thu Sep 4 23:22:49 2025 +0800

Fix not responding with subword bug

commit d042ddd89a75df9a7d49e5253cd6004c50a3adfa
Author: Wei De Chien <wade00754@gmail.com>
Date: Sat Aug 2 17:00:47 2025 +0800

build: deploy to Heroku

commit 63f54a230fb861cafe05ef38d231c4d4a44cce78
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 25 01:43:42 2025 +0800

fix: Escape symbols properly and add exception control

commit c457243b5c5dfee2a574bfef187ac14644f04455
Author: Koios <ken1357924681010@gmail.com>
Date: Mon Jul 21 15:44:34 2025 +0800

Add error handling

commit 26b769d901819a8f02e4742b988818a61e019994
Author: Koios <ken1357924681010@gmail.com>
Date: Sat Jul 19 18:27:25 2025 +0800

Send query to OJAD without filtering

commit 2ae5dc96198c7dd9aa689dc100571805e7ccd15b
Author: Wei De Chien <wade00754@gmail.com>
Date: Mon Jul 21 22:47:49 2025 +0800

Add 'word' in URLResponse

commit 06e501f56d3b96a5a15d0d78ab05b57ee8c0a4e9
Author: Koios <ken1357924681010@gmail.com>
Date: Mon Jul 21 15:48:14 2025 +0800

Solve CORS issue

commit 5f3e09ddab07e485794dc9a4b3a1235b73f7dc8a
Author: Koios <ken1357924681010@gmail.com>
Date: Mon Jul 14 16:23:07 2025 +0800

Add dict query into router

commit 2c29853c9533a7845a48c6e3b10723c5b839fb11
Author: Wei De Chien <wade00754@gmail.com>
Date: Mon Jul 14 00:53:45 2025 +0800

Simply put, it returns the query URL.

commit 91ebf0b0e67a9e8c36f99f453ff352b774ae48b5
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 4 14:38:14 2025 +0900

Add render.yaml for deploy on render

commit 0ec45b72d863329ae90f37d7f5660686d58ed83c
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 4 14:10:12 2025 +0900

Add vercel.json for deploy on vercel

commit f8c46a991ca449f45c4716813be7148d610a0ef2
Author: Wei De Chien <wade00754@gmail.com>
Date: Sun Jul 13 14:47:43 2025 +0800

Update requirements

Add word not found error handling

commit a62f49731ae29055fa889766ec48b720cdf67532
Author: Wei De Chien <wade00754@gmail.com>
Date: Sun Jul 13 01:32:02 2025 +0800

Add get URL api

commit b45597e4b7518be9d5d064ae75ae36603b6a9526
Author: Wei De Chien <wade00754@gmail.com>
Date: Sun Jul 13 01:11:59 2025 +0800

Refactors API to separate headword search and ID details endpoints

Renames classes and functions to better reflect their specific purposes

Improves error handling with proper HTTP status codes and structured error responses.

commit 30b5ef69b1ef9d628ce18945216a96e93ebc7461
Author: Wei De Chien <wade00754@gmail.com>
Date: Sat Jul 12 22:22:03 2025 +0800

Add new api that can let users to get search result first

commit 91f90bc62587bc0babc11549c52d9364ab56faf0
Author: Wei De Chien <wade00754@gmail.com>
Date: Sat Jul 12 18:05:41 2025 +0800

Add test codes for NLT

commit e5301e2e970555b6e47ee65e0ae61ac55dc78fae
Author: Wei De Chien <wade00754@gmail.com>
Date: Sat Jul 12 17:55:53 2025 +0800

Update get_id() to support more searching ways

commit 1efeb9658b66c2e6bbaeb865b1107e1b92f3787e
Author: Wei De Chien <wade00754@gmail.com>
Date: Fri Jul 11 00:17:04 2025 +0800

Add function that can get "headword_id" of searching words, fix nlb_search() url

commit 1401dade08af65622efbc9ed2fa260a26140a64d
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 4 13:32:26 2025 +0900

Use Router instead of APP, add router into main

commit e185e88a76710543a002ae1c55fa3894f46d43b2
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 4 13:29:57 2025 +0900

Copy usage_query.py

commit 9c5c309d103c6a6ec719b44642c49a7f733f0347
Author: minto <chrischris911226@gmail.com>
Date: Tue Jul 22 12:17:42 2025 +0900

add error handle for

commit 74b9357ddceed8750368507477831ed6e0b05363
Author: minto <chrischris911226@gmail.com>
Date: Tue Jul 8 20:54:05 2025 +0900

add return format error

commit e1c108d9f1cc95418a7f1600acf225bbc715ce1c
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 4 14:17:36 2025 +0900

Read API key from environment var if existst

commit ef2ba75dd9978d7ec54b3d412385669fed69acfc
Author: Koios <ken1357924681010@gmail.com>
Date: Fri Jul 4 13:27:50 2025 +0900

First Commit
Loading
Loading