def get_user_agent():
    """
    Construct and informative user-agent string.
    Includes OS version and docker version info

    Not thread-safe
    :return:
    """

    global user_agent_string
    if user_agent_string is None:
        # get OS type
        try:
            sysinfo = subprocess.check_output('lsb_release -i -r -s'.split(' '))
            dockerinfo = subprocess.check_output('docker --version'.split(' '))

            user_agent_string = ' '.join([sysinfo.replace('\t','/'),
                                          dockerinfo.replace(" version ", "/").replace(", ", "/").replace(' ', '/')]).replace('\n','')
        except:
            user_agent_string = None

    return user_agent_string
def get_user_agent ( ) : global user_agent_string if user_agent_string is None : try : sysinfo = subprocess . check_output ( 'lsb_release -i -r -s' . split ( ' ' ) ) dockerinfo = subprocess . check_output ( 'docker --version' . split ( ' ' ) ) user_agent_string = ' ' . join ( [ sysinfo . replace ( '\t' , '/' ) , dockerinfo . replace ( " version " , "/" ) . replace ( ", " , "/" ) . replace ( ' ' , '/' ) ] ) . replace ( '\n' , '' ) except : user_agent_string = None return user_agent_string
Construct and informative user-agent string.
    Includes OS version and docker version info

    Not thread-safe
    :return: