def GetUserAgent(): """Determines the value of the 'User-agent' header to use for HTTP requests. Returns: String containing the 'user-agent' header value, which includes the SDK version, the platform information, and the version of Python; e.g., "remote_api/1.0.1 Darwin/9.2.0 Python/2.5.2". """ product_tokens = [] product_tokens.append("Google-remote_api/1.0") product_tokens.append(appengine_rpc.GetPlatformToken()) python_version = ".".join(str(i) for i in sys.version_info) product_tokens.append("Python/%s" % python_version) return " ".join(product_tokens)
def _get_user_agent(): """Returns the value of the 'User-Agent' header to use for update requests.""" product_tokens = [] version = sdk_update_checker.GetVersionObject() if version is None: release = 'unknown' else: release = version['release'] product_tokens.append('%s/%s' % (SDK_PRODUCT, release)) # Platform. product_tokens.append(appengine_rpc.GetPlatformToken()) # Python version. python_version = '.'.join(str(i) for i in sys.version_info) product_tokens.append('Python/%s' % python_version) return ' '.join(product_tokens)