Skip to content

Commit

Permalink
Fix the client user-agent headers
Browse files Browse the repository at this point in the history
  • Loading branch information
stefannica committed Dec 20, 2024
1 parent eb86cd5 commit 83564b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/zenml/zen_server/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ def authenticate_external_user(
# between web clients (i.e. the dashboard) and CLI clients (i.e. the
# zenml CLI).
user_agent = request.headers.get("User-Agent", "").lower()
logger.info(f"User agent: {user_agent}")
if "zenml/" in user_agent:
store.update_onboarding_state(
completed_steps={OnboardingStep.DEVICE_VERIFIED}
Expand Down
7 changes: 6 additions & 1 deletion src/zenml/zen_stores/rest_zen_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -4053,7 +4053,12 @@ def get_or_generate_api_token(self) -> str:
)

data: Optional[Dict[str, str]] = None
headers: Dict[str, str] = {}

# Use a custom user agent to identify the ZenML client in the server
# logs.
headers: Dict[str, str] = {
"User-Agent": "zenml/" + zenml.__version__,
}

# Check if an API key is configured
api_key = credentials_store.get_api_key(self.url)
Expand Down

0 comments on commit 83564b2

Please sign in to comment.