torque-http 0.5.0__py3-none-any.whl
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.
- torque_http/__init__.py +121 -0
- torque_http/client.py +1471 -0
- torque_http/exceptions.py +96 -0
- torque_http/models.py +302 -0
- torque_http/py.typed +0 -0
- torque_http/tcp.py +575 -0
- torque_http-0.5.0.dist-info/METADATA +132 -0
- torque_http-0.5.0.dist-info/RECORD +10 -0
- torque_http-0.5.0.dist-info/WHEEL +4 -0
- torque_http-0.5.0.dist-info/licenses/LICENSE +21 -0
torque_http/__init__.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""Torque Python HTTP client — zero external dependencies.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
from torque_http import TorqueHttpClient
|
|
5
|
+
|
|
6
|
+
client = TorqueHttpClient("http://localhost:8108", api_key="your-key")
|
|
7
|
+
results = client.search("products", q="laptop", query_by="title")
|
|
8
|
+
|
|
9
|
+
Multi-node with failover:
|
|
10
|
+
client = TorqueHttpClient(
|
|
11
|
+
["http://node1:8108", "http://node2:8108"],
|
|
12
|
+
api_key="your-key",
|
|
13
|
+
num_retries=5,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
Typed search parameters:
|
|
17
|
+
from torque_http import SearchParameters
|
|
18
|
+
params = SearchParameters(q="laptop", query_by="title", per_page=20)
|
|
19
|
+
results = client.search("products", params)
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from .client import TorqueHttpClient
|
|
23
|
+
from .exceptions import (
|
|
24
|
+
TorqueError,
|
|
25
|
+
TorqueApiError,
|
|
26
|
+
TorqueApiException,
|
|
27
|
+
ObjectNotFound,
|
|
28
|
+
ObjectAlreadyExists,
|
|
29
|
+
RequestUnauthorized,
|
|
30
|
+
RequestForbidden,
|
|
31
|
+
RequestMalformed,
|
|
32
|
+
ServerError,
|
|
33
|
+
ServiceUnavailable,
|
|
34
|
+
RequestTimeout,
|
|
35
|
+
)
|
|
36
|
+
from .models import (
|
|
37
|
+
CollectionAlias,
|
|
38
|
+
CollectionResponse,
|
|
39
|
+
CollectionSchema,
|
|
40
|
+
DeleteResult,
|
|
41
|
+
FieldDefinition,
|
|
42
|
+
HealthResponse,
|
|
43
|
+
ImportResult,
|
|
44
|
+
SearchResult,
|
|
45
|
+
SearchParameters,
|
|
46
|
+
GroupedSearchResult,
|
|
47
|
+
GroupedHit,
|
|
48
|
+
Hit,
|
|
49
|
+
FacetCount,
|
|
50
|
+
FacetResult,
|
|
51
|
+
ApiKey,
|
|
52
|
+
Preset,
|
|
53
|
+
StopwordSet,
|
|
54
|
+
SynonymItem,
|
|
55
|
+
SynonymSet,
|
|
56
|
+
UpdateResult,
|
|
57
|
+
AdminStats,
|
|
58
|
+
)
|
|
59
|
+
from .tcp import (
|
|
60
|
+
DocumentEncoder,
|
|
61
|
+
TorqueIngestClient,
|
|
62
|
+
TorqueBinaryFileWriter,
|
|
63
|
+
BatchAck,
|
|
64
|
+
CommitResult,
|
|
65
|
+
TorqueProtocolError,
|
|
66
|
+
TorqueConnectionError,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
__all__ = [
|
|
70
|
+
# Client
|
|
71
|
+
"TorqueHttpClient",
|
|
72
|
+
# Exceptions
|
|
73
|
+
"TorqueError",
|
|
74
|
+
"TorqueApiError",
|
|
75
|
+
"TorqueApiException",
|
|
76
|
+
"ObjectNotFound",
|
|
77
|
+
"ObjectAlreadyExists",
|
|
78
|
+
"RequestUnauthorized",
|
|
79
|
+
"RequestForbidden",
|
|
80
|
+
"RequestMalformed",
|
|
81
|
+
"ServerError",
|
|
82
|
+
"ServiceUnavailable",
|
|
83
|
+
"RequestTimeout",
|
|
84
|
+
# Models — collections
|
|
85
|
+
"CollectionAlias",
|
|
86
|
+
"CollectionResponse",
|
|
87
|
+
"CollectionSchema",
|
|
88
|
+
"FieldDefinition",
|
|
89
|
+
# Models — documents
|
|
90
|
+
"DeleteResult",
|
|
91
|
+
"ImportResult",
|
|
92
|
+
"UpdateResult",
|
|
93
|
+
# Models — search
|
|
94
|
+
"SearchResult",
|
|
95
|
+
"SearchParameters",
|
|
96
|
+
"GroupedSearchResult",
|
|
97
|
+
"GroupedHit",
|
|
98
|
+
"Hit",
|
|
99
|
+
"FacetCount",
|
|
100
|
+
"FacetResult",
|
|
101
|
+
# Models — API keys
|
|
102
|
+
"ApiKey",
|
|
103
|
+
# Models — config
|
|
104
|
+
"Preset",
|
|
105
|
+
"StopwordSet",
|
|
106
|
+
"SynonymItem",
|
|
107
|
+
"SynonymSet",
|
|
108
|
+
# Models — server
|
|
109
|
+
"HealthResponse",
|
|
110
|
+
"AdminStats",
|
|
111
|
+
# TCP ingest
|
|
112
|
+
"DocumentEncoder",
|
|
113
|
+
"TorqueIngestClient",
|
|
114
|
+
"TorqueBinaryFileWriter",
|
|
115
|
+
"BatchAck",
|
|
116
|
+
"CommitResult",
|
|
117
|
+
"TorqueProtocolError",
|
|
118
|
+
"TorqueConnectionError",
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
__version__ = "0.5.0"
|