https://github.com/argosopentech/ltsuggest
Submit suggestions to a LibreTranslate server from Python
https://github.com/argosopentech/ltsuggest
Last synced: 3 months ago
JSON representation
Submit suggestions to a LibreTranslate server from Python
- Host: GitHub
- URL: https://github.com/argosopentech/ltsuggest
- Owner: argosopentech
- License: mit
- Created: 2023-09-29T23:43:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-30T16:42:28.000Z (over 1 year ago)
- Last Synced: 2025-02-01T08:12:33.327Z (5 months ago)
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LTSuggest
Submit suggestions to a LibreTranslate server from Python### Source
```
# Written by ChatGPT-4import requests
def suggest_translation(url, q, s, source, target):
# Build the JSON payload
payload = {
"q": q,
"s": s,
"source": source,
"target": target
}# Add trailing slash to URL if not present
if not url.endswith("/"):
url += "/"
# Make the request
response = requests.post(f"{url}suggest", json=payload)return response
```