# GPLv3 or later # ( C ) J.Y.Amihud ( blenderdumbass ) 2024 import os import json import zlib import random import urllib.request import urllib.parse def RandomString(size=16): # This will generate random strings, primarily # for the purpose of recognizing the same objects # on the network. good = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM" text = "" for i in range(size): text = text + random.choice(good) return text def Send(host, data): # Compressing data = json.dumps(data) data = data.encode("utf-8") data = zlib.compress(data) # Sending req = urllib.request.Request(host, data=data) # Recieving data = urllib.request.urlopen(req).read() data = zlib.decompress(data) data = json.loads(data) return data