-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OPIK-390]: [SDK] add a project name to creation of traces; #607
Conversation
sdks/python/src/opik/url_helpers.py
Outdated
@@ -6,6 +6,7 @@ | |||
URL_ACCOUNT_DETAILS_POSTFIX: Final[str] = "api/rest/v2/account-details" | |||
URL_WORKSPACE_GET_LIST_POSTFIX: Final[str] = "api/rest/v2/workspaces" | |||
HEALTH_CHECK_URL_POSTFIX: Final[str] = "/is-alive/ping" | |||
SAFE_PARSE_URL: Final[str] = ":/&?=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename it to ALLOWED_URL_CHARACTERS
to be more descriptive
sdks/python/src/opik/url_helpers.py
Outdated
ui_url = get_ui_url() | ||
|
||
return urllib.parse.quote( | ||
f"{ui_url}/{workspace}/redirect/projects?name={project_name}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's split it in 2 steps:
project_path = urllib.parse.quote(f"{workspace}/redirect/projects?name={project_name}", safe=...)
return urllib.parse.join(ui_url, project_path)
It's safer to use join instead of strings formatting for concatenating url parts, because there are cases when someone adds/doesn't add /
in the end or in the beginning of the url part. And it might lead to stuff like https://www.opik.com//my_workspace
, join function is quite smart about such stuff.
Details
Issues
Resolves #
Testing
Documentation