mirror of
https://github.com/xcat2/confluent.git
synced 2026-07-20 08:07:29 +00:00
2af402b13c
Apply ruff's safe autofixes. The changes are mechanical and behaviour-preserving. Issues fixed: - F401: remove unused imports. - F841: drop unused local variables and assignments, including discarded await/return values, unused "except ... as e" bindings, and unused "with ... as name" targets. - F541: remove the f prefix from f-strings that contain no placeholders. - E711: compare against None with "is"/"is not" instead of "=="/"!=". - E712: test truthiness directly instead of comparing to True. - E713: use "x not in y" instead of "not x in y". - E714: use "is not" instead of "not ... is". - E731: convert lambdas bound to a name into def statements. - W291/W293: trim trailing whitespace on touched lines.
31 lines
863 B
Python
31 lines
863 B
Python
import base64
|
|
import pyghmi.redfish.command as ic
|
|
import pyghmi.util.webclient as webclient
|
|
import sys
|
|
import os
|
|
|
|
def iterm_draw(databuf):
|
|
datalen = len(databuf)
|
|
data = base64.b64encode(databuf).decode('utf8')
|
|
sys.stdout.write(
|
|
'\x1b]1337;File=inline=1;size={}:'.format(datalen))
|
|
sys.stdout.write(data)
|
|
sys.stdout.write('\a')
|
|
sys.stdout.write('\n')
|
|
sys.stdout.flush()
|
|
|
|
|
|
i = ic.Command(sys.argv[1], os.environ['XCCUSER'], os.environ['XCCPASS'], verifycallback=lambda x: True)
|
|
i.get_health()
|
|
#url = '/download/Mini_ScreenShot.png?t={}'.format(int(time.time()*1000))
|
|
i.oem.wc.grab_json_response('/api/providers/rp_screenshot')
|
|
url = '/download/HostScreenShot.png'
|
|
fd = webclient.FileDownloader(i.oem.wc, url, sys.argv[2])
|
|
fd.start()
|
|
fd.join()
|
|
if sys.argv[3]:
|
|
imgdata = open(sys.argv[2], 'rb').read()
|
|
iterm_draw(imgdata)
|
|
|
|
|