An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# LTSuggest
Submit suggestions to a LibreTranslate server from Python

### Source
```
# Written by ChatGPT-4

import 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
```