import requests
from io import BytesIO
import tarfile
import openpyxl as op
url = "https://url/files.tar.gz".format(_name.lower())
r1 = requests.get(url, stream=True, verify=False)
#print(_config, r1.status_code)
if (_config and r1.status_code == 200):
try:
tar = tarfile.open(fileobj=BytesIO(r1.content))
bb = tar.extractfile('output/risks.xlsx').read()
wb = op.load_workbook(filename=BytesIO(bb))
ws = wb.worksheets[0]
_data = ws.values
columns = next(_data)[0:]
df = pd.DataFrame(_data, columns=columns)
df['Application'] = _name.upper()
df['ST'] = _config
_final = _final.append(df[1:])
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter