Advertisement
Combreal

NewFWGroup.py

Jul 29th, 2021 (edited)
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. import requests
  2. import json
  3. import sys
  4.  
  5. def NewFWQuery(RestMethod, Query, Arguments, Data):
  6.     headers = {'Authorization' : 'Bearer {fffffffffffffffffffffff=}'}
  7.     URL = "https://qlf-filewave-master.dbs.fr" + Query + Arguments
  8.     if RestMethod == "GET":
  9.         response = requests.get(url=URL, headers=headers)
  10.     elif (RestMethod == "POST") and not (bool(Data)):
  11.         response = requests.post(url=URL, headers=headers)
  12.     elif (RestMethod == "POST") and (bool(Data)):
  13.         response = requests.post(url=URL, headers=headers, data=Data)
  14.     else:
  15.         return
  16.  
  17.     if not response.ok:
  18.         print("Request went wrong\n", response.status_code)
  19.  
  20.     return response
  21.  
  22. name = "Johny"
  23. comment = "so cash"
  24. parentID = 0
  25.  
  26. dataSet = {"name": name, "comment": comment, "parentID": parentID}
  27. #json = json.dumps(dataSet)
  28. #print(json)
  29.  
  30. NewFWQuery("POST", "/filewave/api/devices/v1/groups", "", dataSet)
  31.  
  32. #newclient json
  33. #{"items":[{"device_name":name,"serial":serial}],"actions":[{"params":{"group":ID},"name":"import_or_move_to_group"}]}
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement