Skip to content

Commit

Permalink
use to UPPER_CASE naming style (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaspardBT authored Dec 4, 2024
1 parent e0e7886 commit a7fa1f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

from .types import BeforeRequestContext, BeforeRequestHook

prefix = "mistral-client-python/"
PREFIX = "mistral-client-python/"

class CustomUserAgentHook(BeforeRequestHook):
def before_request(
self, hook_ctx: BeforeRequestContext, request: httpx.Request
) -> Union[httpx.Request, Exception]:
current = request.headers["user-agent"]
if current.startswith(prefix):
if current.startswith(PREFIX):
return request

request.headers["user-agent"] = (
prefix + current.split(" ")[1]
PREFIX + current.split(" ")[1]
)

return request
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

from .types import BeforeRequestContext, BeforeRequestHook

prefix = "mistral-client-python/"
PREFIX = "mistral-client-python/"

class CustomUserAgentHook(BeforeRequestHook):
def before_request(
self, hook_ctx: BeforeRequestContext, request: httpx.Request
) -> Union[httpx.Request, Exception]:
current = request.headers["user-agent"]
if current.startswith(prefix):
if current.startswith(PREFIX):
return request

request.headers["user-agent"] = (
prefix + current.split(" ")[1]
PREFIX + current.split(" ")[1]
)

return request
6 changes: 3 additions & 3 deletions src/mistralai/_hooks/custom_user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

from .types import BeforeRequestContext, BeforeRequestHook

prefix = "mistral-client-python/"
PREFIX = "mistral-client-python/"

class CustomUserAgentHook(BeforeRequestHook):
def before_request(
self, hook_ctx: BeforeRequestContext, request: httpx.Request
) -> Union[httpx.Request, Exception]:
current = request.headers["user-agent"]
if current.startswith(prefix):
if current.startswith(PREFIX):
return request

request.headers["user-agent"] = (
prefix + current.split(" ")[1]
PREFIX + current.split(" ")[1]
)

return request

0 comments on commit a7fa1f0

Please sign in to comment.