File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66from runpod .version import __version__ as runpod_version
77
8- os_info = f"{ platform .system ()} { platform .release ()} ; { platform .machine ()} "
98
10- USER_AGENT = f"RunPod-Python-SDK/{ runpod_version } "
11- USER_AGENT += f" ({ os_info } )"
12- USER_AGENT += f" Language/Python { platform .python_version ()} "
9+ def construct_user_agent ():
10+ """ Constructs the User-Agent string for the RunPod-Python-SDK """
11+ os_info = f"{ platform .system ()} { platform .release ()} ; { platform .machine ()} "
12+ python_version = platform .python_version ()
13+ integration_method = os .getenv ('RUNPOD_UA_INTEGRATION' )
1314
15+ ua_components = [
16+ f"RunPod-Python-SDK/{ runpod_version } " ,
17+ f"({ os_info } )" ,
18+ f"Language/Python { python_version } "
19+ ]
1420
15- if os .environ .get ('RUNPOD_UA_INTEGRATION' ) is not None :
16- USER_AGENT += f" Integration/{ os .environ .get ('RUNPOD_UA_INTEGRATION' )} "
21+ if integration_method :
22+ ua_components .append (f"Integration/{ integration_method } " )
23+
24+ user_agent = " " .join (ua_components )
25+ return user_agent
26+
27+
28+ USER_AGENT = construct_user_agent ()
You can’t perform that action at this time.
0 commit comments