Combreal icon

NewFWGroup.py

Combreal | PRO | 01/02/24 02:08:47 PM UTC (Edited) | 0 ⭐ | 1378 👁️ | Never ⏰ | []
Python |

1.05 KB

|

None

|

0 👍

/

0 👎

import requests
import json
import sys
 
def NewFWQuery(RestMethod, Query, Arguments, Data):
    headers = {'Authorization' : 'Bearer {fffffffffffffffffffffff=}'}
    URL = "https://qlf-filewave-master.dbs.fr" + Query + Arguments
    if RestMethod == "GET":
        response = requests.get(url=URL, headers=headers)
    elif (RestMethod == "POST") and not (bool(Data)):
        response = requests.post(url=URL, headers=headers)
    elif (RestMethod == "POST") and (bool(Data)):
        response = requests.post(url=URL, headers=headers, data=Data)
    else:
        return
 
    if not response.ok:
        print("Request went wrong\n", response.status_code)
 
    return response
 
name = "Johny"
comment = "so cash"
parentID = 0
 
dataSet = {"name": name, "comment": comment, "parentID": parentID}
#json = json.dumps(dataSet)
#print(json)
 
NewFWQuery("POST", "/filewave/api/devices/v1/groups", "", dataSet)
 
#newclient json
#{"items":[{"device_name":name,"serial":serial}],"actions":[{"params":{"group":ID},"name":"import_or_move_to_group"}]}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎