mirror of
https://codeberg.org/angestoepselt/imagestack.git
synced 2026-03-21 22:32:17 +00:00
Labelprint Path corrected
This commit is contained in:
parent
62e079b167
commit
6e20b00f72
1 changed files with 12 additions and 1 deletions
|
|
@ -67,6 +67,7 @@ def main():
|
||||||
json_file = args.path
|
json_file = args.path
|
||||||
amount = args.amount
|
amount = args.amount
|
||||||
|
|
||||||
|
print("Request: to {}".format('10.200.4.12:8888/snipe_api'))
|
||||||
response = requests.get("http://10.200.4.12:8888/snipe_api")
|
response = requests.get("http://10.200.4.12:8888/snipe_api")
|
||||||
response.raise_for_status() # raise error if request failed
|
response.raise_for_status() # raise error if request failed
|
||||||
api_key = response.text.strip() # or response.json() if JSON returned
|
api_key = response.text.strip() # or response.json() if JSON returned
|
||||||
|
|
@ -108,7 +109,12 @@ def main():
|
||||||
"authorization": f"Bearer {api_key}",
|
"authorization": f"Bearer {api_key}",
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
|
print("Post hardware")
|
||||||
asset =requests.post("https://computer.z31.it/api/v1/hardware",headers=headers,data=json.dumps(data))
|
asset =requests.post("https://computer.z31.it/api/v1/hardware",headers=headers,data=json.dumps(data))
|
||||||
|
print("Post hardware finished")
|
||||||
|
if asset.status_code != 200:
|
||||||
|
print(f"Error fetching data: HTTP {asset.status_code}")
|
||||||
|
exit(1)
|
||||||
tag =json.loads(asset.content)['payload']['asset_tag']
|
tag =json.loads(asset.content)['payload']['asset_tag']
|
||||||
print_data = {
|
print_data = {
|
||||||
"id": tag,
|
"id": tag,
|
||||||
|
|
@ -118,7 +124,12 @@ def main():
|
||||||
"memory": data["_snipeit_arbeitsspeicher_6"],
|
"memory": data["_snipeit_arbeitsspeicher_6"],
|
||||||
"disk": data["_snipeit_festplatte_4"]
|
"disk": data["_snipeit_festplatte_4"]
|
||||||
}
|
}
|
||||||
res = requests.post("http://10.200.4.12:8888/batch", data=json.dumps(print_data))
|
print("Post batch")
|
||||||
|
res = requests.post("http://10.200.4.12:8888/label", data=json.dumps(print_data))
|
||||||
|
print("Post batch end")
|
||||||
|
if res.status_code != 200:
|
||||||
|
print(f"Error fetching data: HTTP {res.status_code}")
|
||||||
|
exit(1)
|
||||||
print(res.content)
|
print(res.content)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue