0

i wrote client-server api for making users requests in Windows by using platform() library. But, unfortunately, i need to change my code for lsb_release instead platform. An example: request = "version os" in this statement code have to return "lsb_release -a" This is my code bellow:

d = {'version os': f'OS version: {platform.version()}',
 'processor name': f'Processor: {platform.processor()}',
 'machine number': f'Machine: {platform.machine()}',
 }


def error():
    print('Error')


def requestmaker():
    for k in d.keys():
        if k == '':
            error()  
        if k == data.decode("UTF-8").upper():  
            client_data = d[k]  
            return f'{client_data}'.encode() 
yzyz_oK
  • 1
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 22 '22 at 12:23
  • Printing an error without any context and then continuing is not such a good idea. Raise an exception instead. Anyhow, just invoke the commandline program and capture the output. As a new user here, please also take the [tour] and read [ask]. – Ulrich Eckhardt Apr 22 '22 at 13:57
  • 1
    Look at the `lsb_release.py` module. – fpmurphy Apr 22 '22 at 15:34

0 Answers0