Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_package_info(self):
client_name = __name__.split('.')[0]
client_version = __version__ # Version is returned from version.py
# Collect the package info, Python version and OS version.
package_info = {
"client": "{0}/{1}".format(client_name, client_version),
"python": "Python/{v.major}.{v.minor}.{v.micro}".format(v=sys.version_info),
"system": "{0}/{1}".format(platform.system(), platform.release())
}
# Concatenate and format the user-agent string to be passed into request headers
ua_string = []
for key, val in package_info.items():
ua_string.append(val)
return " ".join(ua_string)