#!/bin/env python3 import requests from math import sin from time import sleep import numpy as np import json def sine(): x = 0.0 while True: requests.get(f"http://localhost:8080/add?chart=0&series=R1&x={x}&y={sin(x)}") x += 0.01 sleep(0.01) def sine_array(): x = np.linspace(0, 2*np.pi, 1) y = np.sin(x) data = { "chart": 0, "series": "R1", "points": [ {"x": i[0], "y":i[1]} for i in zip(x,y) ] } r = requests.post("http://0.0.0.0:8080/add", json=data, headers={"Connection":"close"}) print(r.request.body, len(r.request.body)) def star(): points = [ (2,2), (3,0), (0,1), (4,1), (1,0), (2,2) ] for point in points: requests.get(f"http://localhost:8080/add?chart=0&series=R1&x={point[0]}&y={point[1]}") def main(): #sine() sine_array() #star() if __name__ == "__main__": main()