Skip to content

Instantly share code, notes, and snippets.

@itspacchu
Created December 20, 2022 19:46
Show Gist options
  • Save itspacchu/59f73ac294bf33f6d051059e635f32ae to your computer and use it in GitHub Desktop.
Save itspacchu/59f73ac294bf33f6d051059e635f32ae to your computer and use it in GitHub Desktop.
import requests
import base64
import json
PASSWORD = ""
ADD,RM = "add","rm"
API_URL = "https://wisun.api.prashantnook.in/update"
def send_update(nodeA,nodeB,contype=ADD):
headers = {
"Content-Type": "application/json"
}
data = {
"nodeA":nodeA,
"nodeB":nodeB,
"contype":contype,
"key":base64.b64encode(PASSWORD.encode('ascii')).decode('ascii')
}
return requests.post(url=API_URL,headers=headers,data=json.dumps(data)).text
print(send_update("WN-LP01-03","WN-LP02-02",ADD))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment