lkjlkjdsalkj
This commit is contained in:
parent
f3cbb43f91
commit
7e8baa0a48
|
@ -24,7 +24,7 @@ A set of simple API endpoints and ready-to-go clients to interface with the [Grz
|
|||
As the user intended to run the server:
|
||||
|
||||
pip install --user git+https://github.com/Programvareverkstedet/grzegorz_clients.git#master
|
||||
grzegorz-webui --host 0.0.0.0 --port 80
|
||||
grzegorz-webui --host-name 0.0.0.0 --port 80
|
||||
|
||||
It's rather insecure and could use a reverse proxy and some whitelisting. ;)
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ def request_delete(func):
|
|||
url, data = func(*args, **kwargs)
|
||||
if type(data) is dict: data = json.dumps(data)
|
||||
response = requests.delete(f"{BASE_URL}/{url}", data=data)
|
||||
response.raise_for_status() # raises HTTPError of any
|
||||
data = json.loads(response.text)
|
||||
if "error" not in data or data["error"] != False:
|
||||
print(data)
|
||||
|
@ -31,6 +32,7 @@ def request_post(func):
|
|||
url, data = func(*args, **kwargs)
|
||||
if type(data) is dict: data = json.dumps(data)
|
||||
response = requests.post(f"{BASE_URL}/{url}", data=data)
|
||||
response.raise_for_status() # raises HTTPError of any
|
||||
data = json.loads(response.text)
|
||||
if "error" not in data or data["error"] != False:
|
||||
print(data)
|
||||
|
@ -42,6 +44,7 @@ def request_get(func):
|
|||
def new_func(*args, **kwargs):
|
||||
url = func(*args, **kwargs)
|
||||
response = requests.get(f"{BASE_URL}/{url}")
|
||||
response.raise_for_status() # raises HTTPError of any
|
||||
data = json.loads(response.text)
|
||||
if "error" not in data or data["error"] != False:
|
||||
raise APIError(data["errortext"])
|
||||
|
|
Loading…
Reference in New Issue