Skip to content

Commit

Permalink
move import of request lib to when needed so it's not a dependency (#203
Browse files Browse the repository at this point in the history
)

* move import of request lib to when needed so it's not a dependency

* fixed typo

* google apis seem to be needed for grpc-gateway proto methods
  • Loading branch information
zeiler authored Jan 21, 2025
1 parent f02b96d commit 964fa43
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clarifai_grpc/channel/clarifai_channel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import json
import os

import requests

from clarifai_grpc.channel.grpc_json_channel import GRPCJSONChannel
from clarifai_grpc.grpc.api import service_pb2_grpc

Expand Down Expand Up @@ -52,6 +50,8 @@ def get_json_channel(

@staticmethod
def _make_requests_session():
import requests # noqa

http_adapter = requests.adapters.HTTPAdapter(
max_retries=RETRIES, pool_connections=CONNECTIONS, pool_maxsize=CONNECTIONS
)
Expand Down
3 changes: 1 addition & 2 deletions clarifai_grpc/channel/grpc_json_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import re
import typing # noqa

import requests # noqa
from google.protobuf.descriptor import Descriptor # noqa
from google.protobuf.message import Message # noqa

Expand Down Expand Up @@ -43,7 +42,7 @@ class GRPCJSONChannel(object):

def __init__(
self,
session: requests.Session,
session, # type: requests.Session,
base_url: str = BASE_URL,
service_descriptor: typing.Any = _V2,
) -> None:
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ googleapis-common-protos>=1.57.0
grpcio>=1.53.2 ; python_version<'3.13'
grpcio>=1.68.0 ; python_version>='3.13'
protobuf==3.20.3
requests>=2.28.1
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ autoflake==1.4
black==22.3.0
pytest==6.2.2
pytest-xdist==2.2.1
requests==2.28.1

0 comments on commit 964fa43

Please sign in to comment.