Socket

baikunthareemala year ago

Can somebody post the exact postman api format to connect with socket
i tried everything but can not connect to the socket.

Anton Tananaeva year ago

Please don't duplicate your questions.

br2ea year ago

EXAMPLE

import requests
import json
import logging
import datetime
import time
from datetime import timedelta
from tqdm import tqdm

logging.basicConfig(filename='monitor.log', encoding='utf-8', level=logging.INFO)
logging.info(str(datetime.datetime.now()) + ' Inicio do processo.')

v_server="http://127.0.0.0.1:8082"
v_token="d5ec89fffe35ef89e621b168ddcd0067" # USER ADMIN

session = requests.Session()
Logon = session.get(v_server+"/api/session?token="+v_token)
name = json.loads(Logon.content)

obj = session.get(v_server+"/api/devices") # session.get(v_server+"/api/devices?all=true") request all devices
session = requests.Session()

session = requests.Session()
Logon = session.get(v_server+"/api/session?token="+v_token)
nome = json.loads(Logon.content)

if obj.reason=="OK":
devices = json.loads(obj.content)