How to connect streaming data source to websocket?

I did what the previous person suggested with wireshark and saw that the way telegraf sends data is with http post method and has a format that can be written in python as follows:

import requests
import time

x1 = 0
x2 = 0
x3 = 0

for i in range(3000) :
  response = requests.post('http://grafana.staged-by-discourse.com/api/live/push/custom_stream_id', data='sma,sma=cpu5,host=smar usage_softirq='+str(x1)+',usage_guest='+str(x2)+',usage_guest_nice='+str(x3), headers={'Authorization':'Bearer '+ 'eyJrIjoiMm03c0lXRWY0VGxrM0Vmd2hBelN6NWdtQ3ZSMHZLMTAiLCJuIjoidGVsIiwiaWQiOjF9'})
  x1+=1
  x2+=2
  x3+=3
  print(response)
  time.sleep(0.4)

it works perfectly and i can make dashboards with my data
change host name so that it works for you and also change the authentication
note: there has to be a space between host=smar and the data part and also a space between bearer and api token