clarifai-grpc 10.6.7__tar.gz → 12.0.4__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.
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/PKG-INFO +19 -7
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/README.md +2 -1
- clarifai_grpc-12.0.4/clarifai_grpc/__init__.py +33 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/clarifai_channel.py +66 -10
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/custom_converters/custom_message_to_dict.py +4 -3
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/grpc_json_channel.py +3 -5
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/http_client.py +6 -3
- clarifai_grpc-12.0.4/clarifai_grpc/grpc/api/resources_pb2.py +995 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/resources_pb2.pyi +9059 -758
- clarifai_grpc-12.0.4/clarifai_grpc/grpc/api/service_pb2.py +1664 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/service_pb2.pyi +9944 -1430
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/service_pb2_grpc.py +3000 -1187
- clarifai_grpc-12.0.4/clarifai_grpc/grpc/api/status/status_code_pb2.py +46 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/status/status_code_pb2.pyi +182 -21
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/status/status_pb2.pyi +50 -6
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/extensions_pb2.py +2 -1
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/extensions_pb2.pyi +16 -3
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/matrix_pb2.pyi +9 -3
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/test_proto_pb2.pyi +43 -5
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/scope/scope_pb2.py +48 -4
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/scope/scope_pb2.pyi +83 -14
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/types/types_pb2.pyi +7 -3
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/util/extension_pb2.pyi +21 -5
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc.egg-info/PKG-INFO +19 -7
- clarifai_grpc-12.0.4/clarifai_grpc.egg-info/requires.txt +8 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/setup.py +18 -9
- clarifai_grpc-10.6.7/clarifai_grpc/grpc/api/resources_pb2.py +0 -748
- clarifai_grpc-10.6.7/clarifai_grpc/grpc/api/service_pb2.py +0 -1340
- clarifai_grpc-10.6.7/clarifai_grpc/grpc/api/status/status_code_pb2.py +0 -36
- clarifai_grpc-10.6.7/clarifai_grpc/grpc/auth/util/__init__.py +0 -0
- clarifai_grpc-10.6.7/clarifai_grpc.egg-info/requires.txt +0 -4
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/LICENSE +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc → clarifai_grpc-12.0.4/clarifai_grpc/channel}/__init__.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/channel → clarifai_grpc-12.0.4/clarifai_grpc/channel/custom_converters}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/custom_converters/custom_dict_to_message.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/errors.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/channel/exceptions.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/channel/custom_converters → clarifai_grpc-12.0.4/clarifai_grpc/grpc}/__init__.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc → clarifai_grpc-12.0.4/clarifai_grpc/grpc/api}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/resources_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc/api → clarifai_grpc-12.0.4/clarifai_grpc/grpc/api/status}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/status/status_code_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/status/status_pb2.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/status/status_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc/api/status → clarifai_grpc-12.0.4/clarifai_grpc/grpc/api/utils}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/extensions_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/matrix_pb2.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/matrix_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/test_proto_pb2.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/api/utils/test_proto_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc/api/utils → clarifai_grpc-12.0.4/clarifai_grpc/grpc/auth}/__init__.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc/auth → clarifai_grpc-12.0.4/clarifai_grpc/grpc/auth/scope}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/scope/scope_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc/auth/scope → clarifai_grpc-12.0.4/clarifai_grpc/grpc/auth/types}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/types/types_pb2.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/types/types_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7/clarifai_grpc/grpc/auth/types → clarifai_grpc-12.0.4/clarifai_grpc/grpc/auth/util}/__init__.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/util/extension_pb2.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc/grpc/auth/util/extension_pb2_grpc.py +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc.egg-info/SOURCES.txt +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc.egg-info/dependency_links.txt +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/clarifai_grpc.egg-info/top_level.txt +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/setup.cfg +0 -0
- {clarifai_grpc-10.6.7 → clarifai_grpc-12.0.4}/tests/test_common_tests.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: clarifai-grpc
|
|
3
|
-
Version:
|
|
3
|
+
Version: 12.0.4
|
|
4
4
|
Summary: Clarifai gRPC API Client
|
|
5
5
|
Home-page: https://github.com/Clarifai/clarifai-python-grpc
|
|
6
6
|
Author: Clarifai
|
|
@@ -13,12 +13,24 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Requires-Python: >=3.8
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist: grpcio>=1.
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
16
|
+
Requires-Dist: grpcio>=1.53.2; python_version < "3.13"
|
|
17
|
+
Requires-Dist: grpcio>=1.68.0; python_version >= "3.13"
|
|
18
|
+
Requires-Dist: protobuf>=5.29.5
|
|
19
|
+
Requires-Dist: googleapis-common-protos>=1.57.0
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: description-content-type
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: license
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
Dynamic: requires-dist
|
|
29
|
+
Dynamic: requires-python
|
|
30
|
+
Dynamic: summary
|
|
31
|
+
|
|
32
|
+

|
|
20
33
|
|
|
21
|
-

|
|
22
34
|
|
|
23
35
|
# Clarifai Python gRPC Client
|
|
24
36
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
__version__ = "12.0.4"
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
# pop off env var set to the old python implementation
|
|
6
|
+
unset = False
|
|
7
|
+
if os.environ.get('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION', None) == 'python':
|
|
8
|
+
unset = True
|
|
9
|
+
os.environ.pop('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION')
|
|
10
|
+
# Don't use the clarifai logger since it is in the SDK package and depends on protobuf.
|
|
11
|
+
import logging
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
if unset:
|
|
16
|
+
logger.warning(
|
|
17
|
+
"Unsetting PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python env var while importing clarifai package. It's best to unset this env var in your environemnt for faster performance."
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
from google.protobuf.internal import api_implementation
|
|
22
|
+
|
|
23
|
+
if api_implementation.Type() == 'python':
|
|
24
|
+
logger.warning(
|
|
25
|
+
"The python version of google protobuf is being used. We recommend that you upgrade the protobuf package >=4.21.0 to use the upd version which is much faster."
|
|
26
|
+
)
|
|
27
|
+
# and not os.environ.get('CLARIFAI_SKIP_PROTOBUF_CHECK', 'false') == 'true'
|
|
28
|
+
# ):
|
|
29
|
+
# raise Exception(
|
|
30
|
+
# "We do not recommend running this library with the Python implementation of Protocol Buffers. Please check your installation to use the cpp or upb implementation. We recommend setting the environment variable PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb. You can skip this check by setting CLARIFAI_SKIP_PROTOBUF_CHECK=true"
|
|
31
|
+
# )
|
|
32
|
+
except ImportError:
|
|
33
|
+
pass
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import grpc
|
|
5
5
|
|
|
6
6
|
from clarifai_grpc.channel.grpc_json_channel import GRPCJSONChannel
|
|
7
|
-
from clarifai_grpc.grpc.api import service_pb2_grpc
|
|
8
7
|
|
|
9
8
|
RETRIES = 2 # if connections fail retry a couple times.
|
|
10
|
-
CONNECTIONS =
|
|
11
|
-
|
|
9
|
+
CONNECTIONS = (
|
|
10
|
+
20 # number of connections to maintain in pool, only usd for json channel, not direct GRPC.
|
|
11
|
+
)
|
|
12
|
+
MAX_MESSAGE_LENGTH = 1024 * 1024 * 1024 # 1GB
|
|
12
13
|
|
|
13
14
|
wrap_response_deserializer = None
|
|
14
15
|
|
|
@@ -19,9 +20,9 @@ grpc_json_config = json.dumps(
|
|
|
19
20
|
"name": [{"service": "clarifai.api.V2"}],
|
|
20
21
|
"retryPolicy": {
|
|
21
22
|
"maxAttempts": 5,
|
|
22
|
-
"initialBackoff": "
|
|
23
|
+
"initialBackoff": "0.01s",
|
|
23
24
|
"maxBackoff": "5s",
|
|
24
|
-
"backoffMultiplier":
|
|
25
|
+
"backoffMultiplier": 2,
|
|
25
26
|
"retryableStatusCodes": ["UNAVAILABLE"],
|
|
26
27
|
},
|
|
27
28
|
}
|
|
@@ -52,6 +53,8 @@ class ClarifaiChannel:
|
|
|
52
53
|
|
|
53
54
|
@staticmethod
|
|
54
55
|
def _make_requests_session():
|
|
56
|
+
import requests # noqa
|
|
57
|
+
|
|
55
58
|
http_adapter = requests.adapters.HTTPAdapter(
|
|
56
59
|
max_retries=RETRIES, pool_connections=CONNECTIONS, pool_maxsize=CONNECTIONS
|
|
57
60
|
)
|
|
@@ -76,16 +79,17 @@ class ClarifaiChannel:
|
|
|
76
79
|
if root_certificates_path:
|
|
77
80
|
with open(root_certificates_path, "rb") as f:
|
|
78
81
|
root_certificates = f.read()
|
|
79
|
-
credentials =
|
|
82
|
+
credentials = grpc.ssl_channel_credentials(root_certificates)
|
|
80
83
|
else:
|
|
81
|
-
credentials =
|
|
84
|
+
credentials = grpc.ssl_channel_credentials()
|
|
82
85
|
|
|
83
|
-
return
|
|
86
|
+
return grpc.secure_channel(
|
|
84
87
|
base,
|
|
85
88
|
credentials,
|
|
86
89
|
options=[
|
|
87
90
|
("grpc.service_config", grpc_json_config),
|
|
88
91
|
("grpc.max_receive_message_length", MAX_MESSAGE_LENGTH),
|
|
92
|
+
("grpc.max_send_message_length", MAX_MESSAGE_LENGTH),
|
|
89
93
|
],
|
|
90
94
|
)
|
|
91
95
|
|
|
@@ -102,10 +106,62 @@ class ClarifaiChannel:
|
|
|
102
106
|
|
|
103
107
|
channel_address = "{}:{}".format(base, port)
|
|
104
108
|
|
|
105
|
-
return
|
|
109
|
+
return grpc.insecure_channel(
|
|
110
|
+
channel_address,
|
|
111
|
+
options=[
|
|
112
|
+
("grpc.service_config", grpc_json_config),
|
|
113
|
+
("grpc.max_receive_message_length", MAX_MESSAGE_LENGTH),
|
|
114
|
+
("grpc.max_send_message_length", MAX_MESSAGE_LENGTH),
|
|
115
|
+
],
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
@staticmethod
|
|
119
|
+
def get_aio_grpc_channel(base=None, root_certificates_path=None):
|
|
120
|
+
global wrap_response_deserializer
|
|
121
|
+
wrap_response_deserializer = _response_deserializer_for_grpc
|
|
122
|
+
|
|
123
|
+
if not base:
|
|
124
|
+
base = os.environ.get("CLARIFAI_GRPC_BASE", "api.clarifai.com")
|
|
125
|
+
if base.startswith("http:") or base.startswith("https:"):
|
|
126
|
+
raise ValueError(
|
|
127
|
+
"For secure channels the 'base' passed via arguments or env variable CLARIFAI_GRPC_BASE should not start with http:// or https:// but be a direct api endpoint like 'api.clarifai.com'"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
if root_certificates_path:
|
|
131
|
+
with open(root_certificates_path, "rb") as f:
|
|
132
|
+
root_certificates = f.read()
|
|
133
|
+
credentials = grpc.ssl_channel_credentials(root_certificates)
|
|
134
|
+
else:
|
|
135
|
+
credentials = grpc.ssl_channel_credentials()
|
|
136
|
+
|
|
137
|
+
return grpc.aio.secure_channel(
|
|
138
|
+
base,
|
|
139
|
+
credentials,
|
|
140
|
+
options=[
|
|
141
|
+
("grpc.service_config", grpc_json_config),
|
|
142
|
+
("grpc.max_receive_message_length", MAX_MESSAGE_LENGTH),
|
|
143
|
+
("grpc.max_send_message_length", MAX_MESSAGE_LENGTH),
|
|
144
|
+
],
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
@staticmethod
|
|
148
|
+
def get_aio_insecure_grpc_channel(base=None, port=18080):
|
|
149
|
+
global wrap_response_deserializer
|
|
150
|
+
wrap_response_deserializer = _response_deserializer_for_grpc
|
|
151
|
+
|
|
152
|
+
if not base:
|
|
153
|
+
base = os.environ.get("CLARIFAI_GRPC_BASE", None)
|
|
154
|
+
|
|
155
|
+
if not base:
|
|
156
|
+
raise ValueError("Please set 'base' via arguments or env variable CLARIFAI_GRPC_BASE")
|
|
157
|
+
|
|
158
|
+
channel_address = "{}:{}".format(base, port)
|
|
159
|
+
|
|
160
|
+
return grpc.aio.insecure_channel(
|
|
106
161
|
channel_address,
|
|
107
162
|
options=[
|
|
108
163
|
("grpc.service_config", grpc_json_config),
|
|
109
164
|
("grpc.max_receive_message_length", MAX_MESSAGE_LENGTH),
|
|
165
|
+
("grpc.max_send_message_length", MAX_MESSAGE_LENGTH),
|
|
110
166
|
],
|
|
111
167
|
)
|
|
@@ -24,15 +24,16 @@ def protobuf_to_dict(object_protobuf, use_integers_for_enums=True, ignore_show_e
|
|
|
24
24
|
class _CustomPrinter(_Printer):
|
|
25
25
|
def __init__(
|
|
26
26
|
self,
|
|
27
|
+
*,
|
|
27
28
|
including_default_value_fields,
|
|
28
29
|
preserving_proto_field_name,
|
|
29
30
|
use_integers_for_enums,
|
|
30
31
|
ignore_show_empty,
|
|
31
32
|
):
|
|
32
33
|
super(_CustomPrinter, self).__init__(
|
|
33
|
-
including_default_value_fields,
|
|
34
|
-
preserving_proto_field_name,
|
|
35
|
-
use_integers_for_enums,
|
|
34
|
+
always_print_fields_with_no_presence=including_default_value_fields,
|
|
35
|
+
preserving_proto_field_name=preserving_proto_field_name,
|
|
36
|
+
use_integers_for_enums=use_integers_for_enums,
|
|
36
37
|
)
|
|
37
38
|
self._ignore_show_empty = ignore_show_empty
|
|
38
39
|
|
|
@@ -3,14 +3,13 @@ import logging
|
|
|
3
3
|
import re
|
|
4
4
|
import typing # noqa
|
|
5
5
|
|
|
6
|
-
import requests # noqa
|
|
7
6
|
from google.protobuf.descriptor import Descriptor # noqa
|
|
8
7
|
from google.protobuf.message import Message # noqa
|
|
9
8
|
|
|
10
9
|
from clarifai_grpc.channel import http_client
|
|
11
10
|
from clarifai_grpc.channel.custom_converters.custom_dict_to_message import dict_to_protobuf
|
|
12
11
|
from clarifai_grpc.channel.custom_converters.custom_message_to_dict import protobuf_to_dict
|
|
13
|
-
from clarifai_grpc.channel.errors import
|
|
12
|
+
from clarifai_grpc.channel.errors import NotImplementedCaller, UsageError
|
|
14
13
|
from clarifai_grpc.channel.exceptions import ClarifaiException
|
|
15
14
|
from clarifai_grpc.grpc.api.service_pb2 import _V2
|
|
16
15
|
|
|
@@ -43,7 +42,7 @@ class GRPCJSONChannel(object):
|
|
|
43
42
|
|
|
44
43
|
def __init__(
|
|
45
44
|
self,
|
|
46
|
-
session: requests.Session,
|
|
45
|
+
session, # type: requests.Session,
|
|
47
46
|
base_url: str = BASE_URL,
|
|
48
47
|
service_descriptor: typing.Any = _V2,
|
|
49
48
|
) -> None:
|
|
@@ -417,8 +416,7 @@ def _pick_proper_endpoint(
|
|
|
417
416
|
|
|
418
417
|
if not best_match_url:
|
|
419
418
|
raise Exception(
|
|
420
|
-
"You must set one case of the following fields in your request proto: "
|
|
421
|
-
"%s" % all_fields
|
|
419
|
+
"You must set one case of the following fields in your request proto: %s" % all_fields
|
|
422
420
|
)
|
|
423
421
|
|
|
424
422
|
return best_match_url, best_match_method, best_match_url_fields
|
|
@@ -4,11 +4,10 @@ import logging
|
|
|
4
4
|
import os
|
|
5
5
|
import typing # noqa
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
from clarifai_grpc import __version__
|
|
9
8
|
from clarifai_grpc.channel.errors import ApiError
|
|
10
9
|
|
|
11
|
-
CLIENT_VERSION =
|
|
10
|
+
CLIENT_VERSION = __version__
|
|
12
11
|
OS_VER = os.sys.platform
|
|
13
12
|
PYTHON_VERSION = ".".join(
|
|
14
13
|
map(
|
|
@@ -39,6 +38,7 @@ class HttpClient:
|
|
|
39
38
|
"Content-Type": "application/json",
|
|
40
39
|
"X-Clarifai-gRPC-Client": "python:%s" % CLIENT_VERSION,
|
|
41
40
|
"Python-Client": "%s:%s" % (OS_VER, PYTHON_VERSION),
|
|
41
|
+
"X-Clarifai-Request-ID-Prefix": f"python-json-{CLIENT_VERSION}",
|
|
42
42
|
"Authorization": "Key %s" % self._auth_string,
|
|
43
43
|
}
|
|
44
44
|
logger.debug("=" * 100)
|
|
@@ -50,6 +50,9 @@ class HttpClient:
|
|
|
50
50
|
json.dumps(headers, indent=2),
|
|
51
51
|
json.dumps(succinct_payload, indent=2),
|
|
52
52
|
)
|
|
53
|
+
# Avoid import at the top so we don't depend on requests in requirements.txt
|
|
54
|
+
import requests # noqa
|
|
55
|
+
|
|
53
56
|
try:
|
|
54
57
|
if method == "GET":
|
|
55
58
|
res = self._session.get(
|