Commit b8866fa5 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

added new package villas.web for loading results from VILLASweb

parent b13847a1
......@@ -31,7 +31,7 @@ setup(
license = 'GPL-3.0',
keywords = 'simulation power system real-time data processing',
url = 'https://git.rwth-aachen.de/acs/public/villas/dataprocessing',
packages = [ 'villas.dataprocessing' ],
packages = [ 'villas.dataprocessing', 'villas.web' ],
long_description = read('README.md'),
classifiers = [
'Development Status :: 4 - Beta',
......@@ -45,7 +45,8 @@ setup(
install_requires = [
'matplotlib',
'numpy',
'pandas'
'pandas',
'requests'
],
setup_requires = [
'm2r',
......
import requests
from zipfile import ZipFile
class Result:
def __init__(self, file_id, token, endpoint='https://villas.k8s.eonerc.rwth-aachen.de'):
self.file_id = file_id
self.token = token
self.endpoint = endpoint
def open(self):
resp = requests.request('GET',
url=f'{self.endpoint}/api/v2/files/{self.file_id}',
headers={
'Authorization': 'Bearer ' + self.token
},
stream=True)
resp.raise_for_status()
return resp.raw
def open_zip(self, filename):
f = self.open()
zf = ZipFile(f)
return zf.open(filename)
import pandas
from villas.web.result import Result
if __name__ == '__main__':
r = Result('https://l.0l.de/W3OQo', '')
f = r.open_zip('Sample100.csv')
df = pandas.read_csv(f)
print(df)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment