adtr-client 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
+
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
9
+
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
+
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
14
+
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: adtr_client
3
+ Version: 0.0.1
4
+ Summary: A simple Python client for the [Adtr Translation API]
5
+ Author-email: pi11 <webii@pm.me>
6
+ License: DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
7
+ Version 2, December 2004
8
+
9
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
10
+
11
+ Everyone is permitted to copy and distribute verbatim or modified
12
+ copies of this license document, and changing it is allowed as long
13
+ as the name is changed.
14
+
15
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
16
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
17
+
18
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
19
+
20
+
21
+ Project-URL: Homepage, https://github.com/pi11/adtr_client
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ # Adtr Translation Client
30
+
31
+ A simple Python client for the [Adtr Translation API](https://adtr.webnova.one/docs).
32
+
33
+ ## Installation
34
+
35
+ Install the client using pip:
36
+
37
+ ```bash
38
+ pip install adtr_client
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Use the client to translate text via the Adtr Translation API.
44
+
45
+ Example:
46
+
47
+ ```python
48
+ from adtr_client.translate import translate
49
+
50
+ result = translate(
51
+ user_id="your_user_id",
52
+ api_key="your_api_key",
53
+ text="text to translate",
54
+ target_language="target_language"
55
+ )
56
+
57
+ print(result)
58
+ ```
59
+
60
+ ## Configuration
61
+
62
+ 1. Obtain your `user_id` and `api_key` from the rkn.name service
63
+ 2. Replace `"your_user_id"`, `"your_api_key"`, and other parameters in the example above with your credentials and desired values.
64
+
65
+ ```
66
+
@@ -0,0 +1,38 @@
1
+ # Adtr Translation Client
2
+
3
+ A simple Python client for the [Adtr Translation API](https://adtr.webnova.one/docs).
4
+
5
+ ## Installation
6
+
7
+ Install the client using pip:
8
+
9
+ ```bash
10
+ pip install adtr_client
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Use the client to translate text via the Adtr Translation API.
16
+
17
+ Example:
18
+
19
+ ```python
20
+ from adtr_client.translate import translate
21
+
22
+ result = translate(
23
+ user_id="your_user_id",
24
+ api_key="your_api_key",
25
+ text="text to translate",
26
+ target_language="target_language"
27
+ )
28
+
29
+ print(result)
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ 1. Obtain your `user_id` and `api_key` from the rkn.name service
35
+ 2. Replace `"your_user_id"`, `"your_api_key"`, and other parameters in the example above with your credentials and desired values.
36
+
37
+ ```
38
+
@@ -0,0 +1,17 @@
1
+ [project]
2
+ name = "adtr_client"
3
+ version = "0.0.1"
4
+ authors = [
5
+ { name="pi11", email="webii@pm.me" },
6
+ ]
7
+ description = "A simple Python client for the [Adtr Translation API]"
8
+ readme = "README.md"
9
+ requires-python = ">=3.9"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Operating System :: OS Independent",
13
+ ]
14
+ license = { file = "LICENSE" }
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/pi11/adtr_client"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: adtr_client
3
+ Version: 0.0.1
4
+ Summary: A simple Python client for the [Adtr Translation API]
5
+ Author-email: pi11 <webii@pm.me>
6
+ License: DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
7
+ Version 2, December 2004
8
+
9
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
10
+
11
+ Everyone is permitted to copy and distribute verbatim or modified
12
+ copies of this license document, and changing it is allowed as long
13
+ as the name is changed.
14
+
15
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
16
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
17
+
18
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
19
+
20
+
21
+ Project-URL: Homepage, https://github.com/pi11/adtr_client
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ # Adtr Translation Client
30
+
31
+ A simple Python client for the [Adtr Translation API](https://adtr.webnova.one/docs).
32
+
33
+ ## Installation
34
+
35
+ Install the client using pip:
36
+
37
+ ```bash
38
+ pip install adtr_client
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Use the client to translate text via the Adtr Translation API.
44
+
45
+ Example:
46
+
47
+ ```python
48
+ from adtr_client.translate import translate
49
+
50
+ result = translate(
51
+ user_id="your_user_id",
52
+ api_key="your_api_key",
53
+ text="text to translate",
54
+ target_language="target_language"
55
+ )
56
+
57
+ print(result)
58
+ ```
59
+
60
+ ## Configuration
61
+
62
+ 1. Obtain your `user_id` and `api_key` from the rkn.name service
63
+ 2. Replace `"your_user_id"`, `"your_api_key"`, and other parameters in the example above with your credentials and desired values.
64
+
65
+ ```
66
+
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/translate.py
5
+ src/adtr_client.egg-info/PKG-INFO
6
+ src/adtr_client.egg-info/SOURCES.txt
7
+ src/adtr_client.egg-info/dependency_links.txt
8
+ src/adtr_client.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ translate
@@ -0,0 +1,44 @@
1
+ from requests import Session
2
+
3
+ def translate(
4
+ user_id: int, api_key: str, text: str, target_language: str = "russian"
5
+ ) -> str:
6
+ """
7
+ Translate text to the specified target language.
8
+
9
+ Args:
10
+ user_id: User ID from rkn.name service
11
+ api_key: Api key from rkn.name service
12
+ text (str): Text to translate (max 300 characters)
13
+ target_language (str, optional): Target language for translation. Defaults to "russian".
14
+
15
+ Returns:
16
+ str: translated text
17
+
18
+ Raises:
19
+ requests.exceptions.HTTPError: If the API returns an error
20
+ ValueError: If input validation fails
21
+ """
22
+ if not text.strip():
23
+ raise ValueError("Text cannot be empty")
24
+
25
+ if len(text) > 300:
26
+ raise ValueError("Text must be 300 characters or less")
27
+
28
+ base_url = "https://adtr.webnova.one"
29
+ endpoint = f"{base_url}/translate"
30
+
31
+ payload = {
32
+ "user_id": user_id,
33
+ "api_key": api_key,
34
+ "text": text,
35
+ "target_language": target_language,
36
+ }
37
+
38
+ session = Session()
39
+ response = session.post(endpoint, json=payload)
40
+
41
+ response.raise_for_status()
42
+
43
+ data = response.json()
44
+ return data["result"]